15-08-2023, 04:24 PM
(This post was last modified: 16-08-2023, 07:49 AM by josemendez.)
(14-08-2023, 08:29 PM)josemendez Wrote: Hi,
It entirely depends on the value of “i_lastParticleIndex”, that’s why I asked how you are calculating it. But in general no, rope.solver.positions contains all particles managed by that solver, not just the particles for one particular rope. See:
http://obi.virtualmethodstudio.com/manua...cture.html
http://obi.virtualmethodstudio.com/manua...icles.html
Particle, Particle group and Attachment are 3 completely different things. If you mean how to get the position of the last particle in the rope, you can use this snippet I suggested before:
Code:int lastParticleIndex = rope.elements[rope.elements.Count-1].particle2;
var position = rope.solver.transform.TransformPoint(rope.solver.positions[lastParticleIndex]);
If you're interested in particle groups instead, to get the index of a particle in a group you do:
Code:var group= rope.blueprint.groups[groupIndex];
int particleIndex = rope.solverIndices[group.particleIndices[0]]; // in a rope, all groups contain a single particle.
Using this index you can look up its position in the solver.positions array as well.
Attachments have no position, since they're just a constraint relationship between a particle group and a transform.
Hi, so if you imagine a rope, with three particleAttachments, each with a unique particleGroup, where index 0 is left, index 1 is middle and index 2 is the right end of the rope.
I want to know the position that is, index 2.