19-10-2021, 05:43 PM
(18-10-2021, 11:20 AM)josemendez Wrote: DeactivateParticle() does what it claims to do: deactivates the particle. However it does not deal with any constraints that might currently be referencing or depending on that particle. Since behavior when a constraint references an inactive particle is undefined, you'll get strange results unless you deactivate these constraints too.
You must deactivate all constraints that reference an inactive particle. This can get pretty complex and resource intensive if you're going to do it multiple times every frame, since you must iterate trough all active constraints of all kinds and check which ones reference the particle. Another option that might be enough for your use case is to just freeze the particle in place by setting its inverse mass to zero (see:http://obi.virtualmethodstudio.com/manual/6.2/scriptingparticles.html):
Won't take it out of the simulation, but will ignore any changes done to it, which in practice has the same effect. You can also manually override its position/velocity while frozen.
Yes, call actor.ResetParticles();
Thank you for replying.
I tried it and it worked!