17-01-2020, 10:10 AM
(16-01-2020, 04:32 PM)josemendez Wrote: Hi there!
In 5.0, you don't need to remove constraints before and add them after. A single call to RebuildConstraintsFromElements(); after tearing as many elements as you need will do. We still need to update the docs regarding this.
Code:public class Tear : MonoBehaviour
{
public ObiRope rope;
public void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
rope.Tear(rope.elements[10]);
rope.RebuildConstraintsFromElements();
}
}
}
You can see an example of how its used in ObiRope's ApplyTearing() method, which is what is called each frame when automatic tearing is enabled.
thank you, that did it! yes please update the docs