10-10-2017, 03:14 PM
(This post was last modified: 10-10-2017, 03:16 PM by josemendez.)
(10-10-2017, 11:51 AM)Kalidor Wrote: There is the same behaviour, when i tear the rope at the middle.
The neighboring particles are not fixed.
Works fine for me, this is the code I´m using:
Code:
void Update () {
if (Input.GetKeyDown(KeyCode.A)){
Obi.ObiRope rope = GetComponent<ObiRope>();
rope.DistanceConstraints.RemoveFromSolver(null);
rope.BendingConstraints.RemoveFromSolver(null);
rope.Tear(2);
rope.BendingConstraints.AddToSolver(this);
rope.DistanceConstraints.AddToSolver(this);
// update active bending constraints:
rope.BendingConstraints.SetActiveConstraints();
// upload active particle list to solver:
rope.Solver.UpdateActiveParticles();
}
}
Make sure that you're removing the constraints previous to calling Tear(), and adding them back in afterwards. This should always be done when you add/remove constraints at runtime, no matter if you use Tear() or do the changes manually.
See:
http://obi.virtualmethodstudio.com/tutor...aints.html