02-08-2023, 04:11 PM
(02-08-2023, 07:16 AM)josemendez Wrote: Hi!its worked, thanks. It's worked too with
All it takes is writing the position you want the rope to be attached to in the solver.positions array, at the correct index. Here's some sample code:
Code:// disable the attachment:
attachment.enabled = false;
// retrieve the index of the attached particle, and set its position (converting from world to solver space as required):
int particleIndex = rope.solverIndices[attachment.particleGroup.particleIndices[0]];
rope.solver.positions[particleIndex] = rope.solver.transform.InverseTransformPoint(MyObject.transform.position);
// set the new attachment's target:
attachment.target = MyObject.transform;
// re-enable the attachment:
attachment.enabled = true;
Code:
_obiRope.TeleportParticle(particleIndex, position);