Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add Constraint problems
#1
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
Reply


Messages In This Thread
Add Constraint problems - by datzme - 22-11-2020, 07:01 PM
RE: Add Constraint problems - by josemendez - 23-11-2020, 08:49 AM