Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Indexing Particles while using Obi Rope Cursor
#1
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:

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?
Reply
#2
(17-06-2024, 10:20 AM)MisterToot Wrote: 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:

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?

Hi!

This is the intended way to retrieve particles in the order they appear in the rope, I'm unable to reproduce the outcome you describe.
Added a method that does this in the Crane sample scene and it reliably returns the first and last particles in the rope.

Could you share a small repro scene/project that exhibits this behavior, by sending it to support(at)virtualmethodstudio.com so that I can take a closer look?

thanks!
Reply
#3
(17-06-2024, 11:24 AM)josemendez Wrote: Hi!

This is the intended way to retrieve particles in the order they appear in the rope, I'm unable to reproduce the outcome you describe.
Added a method that does this in the Crane sample scene and it reliably returns the first and last particles in the rope.

Could you share a small repro scene/project that exhibits this behavior, by sending it to support(at)virtualmethodstudio.com so that I can take a closer look?

thanks!

Hey thanks so much for such a fast response - it was of course that I had some small areas (in my debugging code) where I was still checking the particle index rather than using the element reference - all working now! I think just the act of posting on a forum made the errors visible, so thanks again!
Reply