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?
#3
(22-08-2018, 04:03 PM)josemendez Wrote: 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.

Thanks a lot for help. This is exactly what I am looking for.
Reply


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