Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Connect two objects
#3
My problem is that I can not achieve the desired result. If the cube's mass is too small, the cube falls at the moment of connection. If the mass of the cube is larger, then it does not budge, even if the platform falls down and swings like a pendulum.

The rope is disabled and turned on after adding new points.

My code:


Code:
ObiPinConstraintBatch localOPB = new ObiPinConstraintBatch(false, false);
        localOPB.AddConstraint(0, firstTarget.GetComponent<ObiCollider>(), firstTarget.InverseTransformPoint(firstPoint), 0);
        localOPB.AddConstraint(105, secondTarget.GetComponent<ObiCollider>(), secondTarget.InverseTransformPoint(secondPoint), 0);
        localOPB.minYoungModulus = 0;
        localOPB.maxYoungModulus = 200;
        ObiConstraintBatch localOCB = rope.PinConstraints.GetBatches()[0];
        rope.PinConstraints.RemoveFromSolver(null);

        rope.PinConstraints.AddBatch(localOPB);

        rope.PinConstraints.AddToSolver(null);

        rope.PinConstraints.SetActiveConstraints();


        rope.DistanceConstraints.RemoveFromSolver(null);
        rope.BendingConstraints.RemoveFromSolver(null);
        rope.BendingConstraints.AddToSolver(rope);
        rope.DistanceConstraints.AddToSolver(rope);


        rope.BendingConstraints.SetActiveConstraints();

        rope.Solver.UpdateActiveParticles();
Reply


Messages In This Thread
Connect two objects - by elfinik - 27-10-2017, 12:40 PM
RE: Connect two objects - by josemendez - 27-10-2017, 06:04 PM
RE: Connect two objects - by elfinik - 30-10-2017, 09:29 PM
RE: Connect two objects - by josemendez - 31-10-2017, 02:37 PM