#Rope logic not resetting properly

1 messages · Page 1 of 1 (latest)

past sparrow
#

Hey, a while ago I found the Optimized Ropes tool by GOGO GAGA or (Ali Rasheed on Github) but I've run into some issues with disabling and reenabling the rope in different positions. The rope seems to not get recalculated properly and will seemingly snap from its previous position to the current one. But everything in the code (as far as I understand) seems to prevent that, but as I've said on here before I am not the best at math.

I've included a video of the issue. As you can see after the wave effect finishes the rope will snap to its new position. This effect gets worse the further it is moved (I am currently using an object pool of 1 rope just for demonstration).
The way I enable the rope is pretty simple, after the wave effect has finished I just run this segment of code.

if (rope.enabled == false)
{
    lenght = currentLenght;
    rope.ropeLength = lenght;
    
    rope.RecalculateRope();
    rope.enabled = true;
}

ropeStartPoint.position = wrist.position;

As far as I can tell, the RecalculateRope() method should stop this snap from happening but it clearly doesn't. I have tried to call it after enabling the rope but this does not seem to affect anything.

I also tried to use the ResetRope() method, but that only makes the snap effect worse.

Any help with this would be much appreciated, as I am a bit out of my depth on this one. I figured I would have to write a new reset method that takes the new position into account. The link below is the main class for the rope tool in question.

https://paste.mod.gg/oxcbhhotivjl/0

#

Rope logic not resetting properly

twin karma
#
  1. Share the code properly(as large code blocks).
  2. Make sure that recalculate even runs(add logs or use the debugger).
#

!code

radiant pivotBOT
past sparrow
twin karma
#

I don't really see the issue in the video. Might want to break/pause and step through the frames while recording to make it clear.

That being said, the line renderer seem to be updating in SetSplinePoint. So you might want to start debugging from there. Debug logging the positions that are being set there while stepping through the frames could help understand when the positions are invalid(or not those that you expect) and why.

past sparrow