Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is there a way to check that simulation done and all particles is sleeping?
#2
(22-08-2018, 03:48 PM)mmortall Wrote: I need somehow to know that all particles are in sleep state. Because I need to stop simulation then, save simulation mesh etc. 
For now I use just a timer, but I want to use some smart way to check simulation done. So basically I need to know a percent of perticles are in sleep state and if like 99% in sleep state then considering simulation done.

It there a way to do what I wan currently?

The sleep threshold is expressed in Joules/Kg. So simply check if the kinetic energy of the particles is below the sleep threshold. Pseudocode:

Code:
Oni.GetParticleVelocities(solver,velocities,numParticles,startingParticle);
for (int i = 0; i < velocities.Length;++i)
{
    if (velocities[i].sqrMagnitude * 0.5f <= solver.parameters.sleepThreshold)
     // this one is sleeping.
}

See the last bit of: http://obi.virtualmethodstudio.com/tutor...icles.html for more info on how to use low level particle getter/setters.
Reply


Messages In This Thread
RE: Is there a way to check that simulation done and all particles is sleeping? - by josemendez - 22-08-2018, 04:03 PM