Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Resetting Rope causing Error
#9
(07-08-2024, 10:45 AM)vrtraining Wrote: Its called from an event but eventually that is propagated from Update method. It works fine as long as I don't resize the rope. If I increase the rope length and call it then it crashes in Obi 7

I've tried with and without calling ChangeLength(), doesn't make any difference for me. This is the code I'm using, which is nearly identical to yours:

Code:
using UnityEngine;
using Obi;

public class ResetRope : MonoBehaviour
{
    public float initialLength = 3;
    public ObiRope rope;

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.F))
            Reset();
    }

    public void Reset()
    {
        rope.RemoveFromSolver();
        rope.ClearState();
        rope.AddToSolver();
        rope.GetComponent<ObiRopeCursor>().ChangeLength(initialLength - rope.restLength);
    }
}
Reply


Messages In This Thread
Resetting Rope causing Error - by vrtraining - 06-08-2024, 06:33 PM
RE: Resetting Rope causing Error - by vrtraining - 07-08-2024, 07:13 AM
RE: Resetting Rope causing Error - by josemendez - 07-08-2024, 08:06 AM
RE: Resetting Rope causing Error - by vrtraining - 07-08-2024, 08:47 AM
RE: Resetting Rope causing Error - by josemendez - 07-08-2024, 09:38 AM
RE: Resetting Rope causing Error - by vrtraining - 07-08-2024, 09:40 AM
RE: Resetting Rope causing Error - by josemendez - 07-08-2024, 10:20 AM
RE: Resetting Rope causing Error - by vrtraining - 07-08-2024, 10:45 AM
RE: Resetting Rope causing Error - by josemendez - 07-08-2024, 11:53 AM
RE: Resetting Rope causing Error - by josemendez - 07-08-2024, 12:15 PM
RE: Resetting Rope causing Error - by vrtraining - 07-08-2024, 12:50 PM