Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Resetting Rope causing Error
#1
Hi,

This is my old code that I got from this forum to reset the rope back to its original state.

Code:
float initialLength = 0.88f
ObiRopeCursor ropeCursor;
ObiRope rope;

public void ResetRope()
    {
        rope.RemoveFromSolver();
        rope.ClearState();
        rope.AddToSolver();
        ropeCursor.ChangeLength(initialLength);
    }


Now since the new update has changed the ChangeLength() method my new code becomes.

Code:
public void ResetRope()
    {
        rope.RemoveFromSolver();
        rope.ClearState();
        rope.AddToSolver();
        ropeCursor.ChangeLength(initialLength - rope.restLength);
    }

But its causing error, rope disappears and I get

Code:
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <bae5e84a08394aad9eb61062d3ccb3ca>:0)
Obi.ObiPathSmootherRenderSystem.Setup () (at Assets/Obi/Scripts/RopeAndRod/Rendering/ObiPathSmootherRenderSystem.cs:163)
Obi.ObiRenderSystemStack.Setup (System.Int32 dirtyFlags) (at Assets/Obi/Scripts/Common/Solver/ObiRenderSystemStack.cs:27)
Obi.ObiSolver.Render (System.Single unsimulatedTime) (at Assets/Obi/Scripts/Common/Solver/ObiSolver.cs:1784)
Obi.ObiSolver.LateUpdate () (at Assets/Obi/Scripts/Common/Solver/ObiSolver.cs:1163)

If I remove 

Code:
rope.RemoveFromSolver();
rope.ClearState();
rope.AddToSolver();

Then error goes away but I dont get starting initial state like before
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