28-03-2018, 12:22 PM
(This post was last modified: 28-03-2018, 12:22 PM by josemendez.)
(27-03-2018, 08:36 PM)usernameHed Wrote: After a few Failure, i come back to you...
I do not need math, I can handle it, but i need to find the right particle position depending of the rope, and i fail to find it...
I try your link
http://obi.virtualmethodstudio.com/tutor...icles.html
I manage to find the first particle:
actor.GetParticlePosition(0)
OK, but now, i want the "last": actor.GetParticlePosition(actor.velocities.Length - 1)
But it doesn't work...
Maybe this is caused by the 100 pooled particle ? so I do that:
actor.GetParticlePosition(actor.velocities.Length - 1 - rope.PooledParticle)
But no way...
I think i'm close, but i didn't manage to find THE point who are always close to the other extremity of the rope.
I you can help me i'm stuck on it since last time
Thanks
If you are using ObiRopeCursor to change rope length at runtime, keep in mind that new particles will be added mid-rope (or wherever the cursor is). This will cause the last particle in the particles array to be the most recently added one, not necessarily at the end of the rope.
To get the first and last particles in the rope (topologically speaking), you can use distance constraints to find them easily:
Code:
ObiDistanceConstraintBatch dbatch = rope.DistanceConstraints.GetFirstBatch();
int lastParticle = dbatch.springIndices[(dbatch.ConstraintCount-1)*2+1];
int firstParticle = dbatch.springIndices[0];