Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Reset Rope without Movement / Physics
#1
I need to reset the rope to its initial position. My rope is attached to and object and I have moved that object. Now when I reset my object back the rope swings all the way back due to solver and physics. I just want to reset the rope as I reset my attached object. I'm currently using the solution I got from this forum

Code:
rope.RemoveFromSolver();
rope.ClearState();
rope.AddToSolver();
while (!rope.isLoaded) yield return new WaitForEndOfFrame();
ropeCursor.ChangeLength(initialLength - rope.restLength);

This solution was working well in Obi 6 but in Obi 7 its starting to add swing. How I can reset it back to blueprint one without any physics. I just want the rope with its length and particles to reset to its original starting position without any animation or swing along the way. How I can do that?
Reply
#2
(Yesterday, 07:21 AM)vrtraining Wrote: I need to reset the rope to its initial position. My rope is attached to and object and I have moved that object. Now when I reset my object back the rope swings all the way back due to solver and physics. I just want to reset the rope as I reset my attached object. I'm currently using the solution I got from this forum

Code:
rope.RemoveFromSolver();
rope.ClearState();
rope.AddToSolver();
while (!rope.isLoaded) yield return new WaitForEndOfFrame();
ropeCursor.ChangeLength(initialLength - rope.restLength);

This solution was working well in Obi 6 but in Obi 7 its starting to add swing. How I can reset it back to blueprint one without any physics. I just want the rope with its length and particles to reset to its original starting position without any animation or swing along the way. How I can do that?

Hi!

Just tried your code in Obi 7 and it doesn't seem to add any swing/animation: the rope is immediately reset to its blueprint state, no leftover velocity/swing/inertia from previous simulation.

[Image: to2HpdU.gif]

Note that unless your initialLength is in any way different from the blueprint's restLength, this line is unnecessary since the length of the rope will also be reset to that in the blueprint:

Code:
ropeCursor.ChangeLength(initialLength - rope.restLength);

Also keep in mind that in Obi 7, ChangeLength() is asynchronous - the change in length is buffered and only actually applied to the rope on the next solver update, which depending on the context of your resetting code might be causing trouble.

kind regards,
Reply