Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Manual tearing via cript
#7
(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
Reply


Messages In This Thread
Manual tearing via cript - by Kalidor - 09-10-2017, 10:29 AM
RE: Manual tearing via cript - by niZmo - 09-10-2017, 11:32 AM
RE: Manual tearing via cript - by josemendez - 09-10-2017, 02:13 PM
RE: Manual tearing via cript - by ctalDai - 31-07-2019, 06:48 AM
RE: Manual tearing via cript - by Kalidor - 10-10-2017, 09:56 AM
RE: Manual tearing via cript - by josemendez - 10-10-2017, 10:28 AM
RE: Manual tearing via cript - by Kalidor - 10-10-2017, 11:51 AM
RE: Manual tearing via cript - by josemendez - 10-10-2017, 03:14 PM
RE: Manual tearing via cript - by Kalidor - 10-10-2017, 03:44 PM
RE: Manual tearing via cript - by x-lab - 19-10-2017, 11:12 AM
RE: Manual tearing via cript - by josemendez - 19-10-2017, 11:43 AM
RE: Manual tearing via cript - by x-lab - 19-10-2017, 12:13 PM
RE: Manual tearing via cript - by josemendez - 19-10-2017, 01:09 PM
RE: Manual tearing via cript - by x-lab - 19-10-2017, 03:34 PM
RE: Manual tearing via cript - by josemendez - 19-10-2017, 04:13 PM
RE: Manual tearing via cript - by x-lab - 20-10-2017, 11:14 AM
RE: Manual tearing via cript - by josemendez - 20-10-2017, 11:58 AM
RE: Manual tearing via cript - by Sether - 15-01-2020, 04:09 PM
RE: Manual tearing via cript - by josemendez - 16-01-2020, 04:32 PM
RE: Manual tearing via cript - by Sether - 17-01-2020, 10:10 AM
RE: Manual tearing via cript - by zakur0 - 16-01-2020, 01:22 PM
RE: Manual tearing via cript - by josemendez - 16-01-2020, 04:37 PM