19-10-2021, 11:28 AM
(19-10-2021, 11:24 AM)josemendez Wrote: Yes of course! you can express particle data in any space you'd like, including world space. Just use Unity's TransformPoint/Vector/Direction methods:Do I understand correctly that each rope element contains 2 particles? Particle1 and particle2?
https://docs.unity3d.com/ScriptReference...Point.html
You can just take the element at the middle of the rope, and get either particle at its ends. The following code would return the position of the particle in the middle, expressed in world space:
Code:int particleIndex = rope.elements[rope.elements.Count/2].particle1;
var position = rope.solver.transform.TransformPoint(rope.solver.positions[particleIndex]);