Obi Official Forum
Help Unpin particle in run time - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: Help Unpin particle in run time (/thread-1925.html)



Unpin particle in run time - Lokeyyyy - 10-02-2020

I have added particle to handle in run time which has no problem, however when i clear the handle, the cleared particles are fixed in mid-air automatically, is there a way to unfix them when i clear the handle?


RE: Unpin particle in run time - josemendez - 10-02-2020

(10-02-2020, 10:18 AM)Lokeyyyy Wrote: I have added particle to handle in run time which has no problem, however when i clear the handle, the cleared particles are fixed in mid-air automatically, is there a way to unfix them when i clear the handle?

Hi,

I assume you're using Obi 4.X (as in 5.X handles have been replaced by attachments).

Fixing a particle basically means setting its inverse mass to zero. This is equivalent to giving it an infinite mass.

When calling handle.Clear(), all particle inverse masses are reset to their original pre-handle values. Unless your particles were already fixed before added the handle, clearing the handle should not leave any fixed particles. Check that you didn't pass 0 as the original invMass when calling handle.AddParticle(). You should pass the actual inverse mass of the particle, so that the handle can reset it when being removed/cleared. If you pass zero, the handle will reset the inverse mass to zero, leaving the particles fixed forever.


RE: Unpin particle in run time - Lokeyyyy - 11-02-2020

(10-02-2020, 10:44 AM)josemendez Wrote: Hi,

I assume you're using Obi 4.X (as in 5.X handles have been replaced by attachments).

Fixing a particle basically means setting its inverse mass to zero. This is equivalent to giving it an infinite mass.

When calling handle.Clear(), all particle inverse masses are reset to their original pre-handle values. Unless your particles were already fixed before added the handle, clearing the handle should not leave any fixed particles. Check that you didn't pass 0 as the original invMass when calling handle.AddParticle(). You should pass the actual inverse mass of the particle, so that the handle can reset it when being removed/cleared. If you pass zero, the handle will reset the inverse mass to zero, leaving the particles fixed forever.

I have found that I passed 0 as the original invMass in handle.AddParticle(), what value should I pass instead? I found that there is invMass float[] in ObiRope, however it seems to be a empty array, same for invRotMass. How am I suppose to use them? thank you


RE: Unpin particle in run time - josemendez - 11-02-2020

(11-02-2020, 02:37 AM)Lokeyyyy Wrote: I have found that I passed 0 as the original invMass in handle.AddParticle(), what value should I pass instead? I found that there is invMass float[] in ObiRope, however it seems to be a empty array, same for invRotMass. How am I suppose to use them? thank you

Pass
Code:
solver.invMasses[actor.particleIndices[yourIndex]]

See:
http://obi.virtualmethodstudio.com/tutorials_4/scriptingparticles.html