Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change particle mass via script
#2
(20-04-2018, 08:15 PM)leonrdo Wrote: Using ObiRope 3.3, I'm trying to change the mass of a single particle via script following the tutorial http://obi.virtualmethodstudio.com/tutor...icles.html
but its not working the way I think is supposed to work.
For example, calling this code, after a key is pressed,

Code:
float[] mass = new float[1];
mass[0] = 0.0f;
Oni.SetParticleInverseMasses(rope.Solver.OniSolver, mass, 1, rope.particleIndices[1]);

its not keeping the second particle fixed, as I supposed it would make.
Did I miss anything?

Thanks in advance

This does fix the particle for me. However, if the particle had non-zero velocity prior to being fixed, it will keep that velocity (but collisions or constraints will not be able to change it). So you should usually pair this with a call to Oni.SetParticleVelocities() to set its velocity to zero, and optionally also set its position.

cheers,
Reply


Messages In This Thread
Change particle mass via script - by leonrdo - 20-04-2018, 08:15 PM
RE: Change particle mass via script - by josemendez - 21-04-2018, 07:57 AM
RE: Change particle mass via script - by leonrdo - 24-04-2018, 07:33 PM