09-10-2017, 02:13 PM
(This post was last modified: 09-10-2017, 02:14 PM by josemendez.)
(09-10-2017, 11:32 AM)niZmo Wrote: All you have to do is call Tear(constaintIndex) on the rope script. Constraints are in between the particles, so if your rope has particles 0-20 the constraint indices will be 0-19. I found that the rope don’t like to be cut at 0 nore the last constraint. I get an out of range error when cutting the last constraint. Could be other code of mine messing it up, but just a heads up. Also make sure you have particles in your pool. Each cut needs one extra particle.
This. I couldn't have explained it better.
We should probably be checking that the range is correct inside Tear(), since tearing a constraint splits one of the particles at its ends: which one? the one with more mass, or a random one if both have the same. Torn particles (the original one and the new one added at the cut) then have their mass halved.
In the edges of the rope of course, this can cause a cut to attempt to create an additional particle at the very beginning/end of the rope, which is illegal. We check for this whenever we use Tear() inside Obi, but it being a public function we should really perform the check inside of it.
Thanks for pointing it out niZmo.