06-08-2024, 06:33 PM
(This post was last modified: 07-08-2024, 07:14 AM by vrtraining.)
Hi,
This is my old code that I got from this forum to reset the rope back to its original state.
Now since the new update has changed the ChangeLength() method my new code becomes.
But its causing error, rope disappears and I get
If I remove
Then error goes away but I dont get starting initial state like before
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