10-06-2025, 09:40 AM
(10-06-2025, 08:31 AM)alicecatalano Wrote:1. You get the wrong particle (though it may work in your case sometimes, your code is actually an unstable way, or a wrong way). See https://obi.virtualmethodstudio.com/manu...ropes.html. You must use something like this to get particle position:
int solverIndex = rope.solverIndices[i];
Vector3 particlePos = rope.solver.positions[solverIndex]; // GetParticlePosition(solverIndex);
Debug.Log($"particle {solverIndex} position {particlePos}");
int firstParticle = rope.elements[0].particle1;
var firstPos = rope.solver.positions[firstParticle];
2. You get the wrong position. You're getting the local position. If you need world position you must transform local to world.