16-11-2021, 11:22 AM
(This post was last modified: 16-11-2021, 11:26 AM by josemendez.)
(16-11-2021, 11:18 AM)srid96 Wrote: Is the code for last point correct?
actor.solverIndices[actor.solverIndices.Length - 1]
It is correct, as long as you don't have any pooled particles.
Ropes create a pool of auxiliary particles in case you want to resize or cut the rope. (see:http://obi.virtualmethodstudio.com/manual/6.2/ropesetup.html) Check that in your blueprint, the pool size is zero. If it isn't, the last particle in the solverIndices array will be one in the pool, not one in the rope.
For a non-zero pool size (that is, a resizable/cuttable rope), you must use elements as mentioned previously in this thread. Elements are the "edges" in between particles, they join 2 particles each. The last particle in the rope will then be the second particle of the last element:
Code:
var lastPos = solver.renderablePositions[rope.elements[rope.elements.Count-1].particle2];