Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
End of the rope! Match position
#9
(14-08-2023, 04:26 PM)Renman3000 Wrote: Hi,
So a little confused in that, I was thinking that if I called via my own script, an instance of an ObiRope obiRopeX that by further calling obiRopeX.Solver.positions[i_lastParticleIndex], that this would generate the last particle attachment, particle group position, on obiRopeX.

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

Quote:If this is incorrect, how do I get a position of a Particle Attachment, Particle Group?
Thanks

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.
Reply


Messages In This Thread
End of the rope! Match position - by Renman3000 - 07-08-2023, 03:12 PM
RE: End of the rope! Match position - by josemendez - 14-08-2023, 08:29 PM