Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Resetting rope end positions when attaching the rope
#5
(02-08-2023, 07:16 AM)josemendez Wrote: Hi!

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;
its worked, thanks. It's worked too with
Code:
_obiRope.TeleportParticle(particleIndex, position);
Reply


Messages In This Thread
RE: Resetting rope end positions when attaching the rope - by Alexander34 - 02-08-2023, 04:11 PM