Jump to content

Random values in growing range for every nth of frames?


Beginner

Recommended Posts

Hi! I want to get random number for every nth of frames in growing range.

 

I got the seed value to change every nth of frame, but problem is that when using fit expression the random number changes because it's fitted to new range.

 

Tried using wrangle in detail mode to add or set attribute for every nth of frame, problem was that it didn't hold the value. I would not prefer to use sop solver to store the value because there's already bunch of solvers and want this to be agile operation after simulation.

 

I solved this temporary by storing @numpt for every nth of frames in my simulation and then after simulation I have seed that changes for same nth frames. But in this way there is no way to change the rate without re-simulating. Anyway it's just to randomly switch crowd simulation's "agentcam" for visualisation purpose..  

 

 

Link to comment
Share on other sites

My growing number means increasing total number of particles and the randomly selected number should be one of particle's id. So floor function with fit would work but problem is that when the range to fit changes the random number also changes because it's fitted to new range, even when the seed is same. So now I solved this by storing the number of particles to  my own attribute every nth frames and then did random fit with same floor seed rate. Of course the rate is then decided on simulation time, but it's okey in my case.

 

I'm attaching a camera behind particle so if the id is wrong camera wouldn't get right position. It's 3rd perspective view of randomly selected ant in ant crowd simulation, to see closer what's happening :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...