17-06-2024, 10:20 AM
Once a cursor is added to a rope (and the length is altered) it looks like the index of the particles no longer returns in a nice order using the below method:
Instead, I have found I'll get the index of the first particle correct, and the last particle index will be at the first cursor spawn position, and then after that, I can't spy an order to the particles.
I'm using two cursors both facing inward in case that context matters, though I've found the same issue with just one cursor in the crane demo scene also.
Any clues/advice from folks for how to get a nice ordered index of them?
Code:
// first particle in the rope is the first particle of the first element:
int firstParticle = rope.elements[0].particle1;
// last particle in the rope is the second particle of the last element:
int lastParticle = rope.elements[rope.elements.Count-1].particle2;
// now get their positions (expressed in solver space):
var firstPos = rope.solver.positions[firstParticle];
var lastPos = rope.solver.positions[lastParticle];
Instead, I have found I'll get the index of the first particle correct, and the last particle index will be at the first cursor spawn position, and then after that, I can't spy an order to the particles.
I'm using two cursors both facing inward in case that context matters, though I've found the same issue with just one cursor in the crane demo scene also.
Any clues/advice from folks for how to get a nice ordered index of them?