(14-06-2021, 07:34 AM)josemendez Wrote: As long as you've passed the correct offset to the pin constraint, the rope should not move at all.
You should use the current particle position expressed in the rigidbody's local space.
Can you share the code you used?
Code:
private void AttachGrainToRope(int index, ObiColliderBase body)
{
// create a new pin constraints batch
ObiPinConstraintsBatch batch = new ObiPinConstraintsBatch();
batches[index] = batch;
// get a hold of the constraint type we want, in this case, pin constraints:
var pinConstraints = rope.GetConstraintsByType(Oni.ConstraintType.Pin) as ObiConstraints<ObiPinConstraintsBatch>;
batch.AddConstraint(index, body, Vector3.zero, Quaternion.identity, 0, 0, float.PositiveInfinity);
// set the amount of active constraints in the batch to 2 (the ones we just added).
batch.activeConstraintCount = 1;
// append the batch to the pin constraints:
pinConstraints.AddBatch(batch);
// this will cause the solver to rebuild pin constraints at the beginning of the next frame:
rope.SetConstraintsDirty(Oni.ConstraintType.Pin);
}
I use this code to attach a grain object to a rope.