I have some problems with constraints.
This is what im trying to do:
https://i.imgur.com/uMuY596.gif
This is the code
var pinConstraints = rope.GetConstraintsByType(Oni.ConstraintType.Pin) as ObiConstraints<ObiPinConstraintsBatch>;
pinConstraints.Clear();
Vector3 hit = rope.transform.InverseTransformPoint(contact.point); // this didnt work at all.
var batch = new ObiPinConstraintsBatch(); // cheating with the pos, dont know how to get the correct position.
batch.AddConstraint(rope.solverIndices[contact.particle], boxCollider, new Vector3(-0.5f,-0.25f,0), Quaternion.identity,0,0,float.PositiveInfinity);
batch.activeConstraintCount = 1;
boxCollider.Phase = 1;
pinConstraints.AddBatch(batch);
rope.SetConstraintsDirty(Oni.ConstraintType.Pin);
:
what im trying to do is to make it stick to the box smooth, and then i want to be able to drag the box around and rope follow smoothly.
I also tried to use the Grab script, it looks good, but it will go crazy kinda fast:
https://i.imgur.com/zogiZZZ.gif
This is what im trying to do:
https://i.imgur.com/uMuY596.gif
This is the code
var pinConstraints = rope.GetConstraintsByType(Oni.ConstraintType.Pin) as ObiConstraints<ObiPinConstraintsBatch>;
pinConstraints.Clear();
Vector3 hit = rope.transform.InverseTransformPoint(contact.point); // this didnt work at all.
var batch = new ObiPinConstraintsBatch(); // cheating with the pos, dont know how to get the correct position.
batch.AddConstraint(rope.solverIndices[contact.particle], boxCollider, new Vector3(-0.5f,-0.25f,0), Quaternion.identity,0,0,float.PositiveInfinity);
batch.activeConstraintCount = 1;
boxCollider.Phase = 1;
pinConstraints.AddBatch(batch);
rope.SetConstraintsDirty(Oni.ConstraintType.Pin);
:
what im trying to do is to make it stick to the box smooth, and then i want to be able to drag the box around and rope follow smoothly.
I also tried to use the Grab script, it looks good, but it will go crazy kinda fast:
https://i.imgur.com/zogiZZZ.gif