Obi Official Forum
Help [FIXED] Rope Lagging Behind Attachment - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: Help [FIXED] Rope Lagging Behind Attachment (/thread-3352.html)



[FIXED] Rope Lagging Behind Attachment - VirtualCucumber - 07-03-2022

Hi, long term Obi user since 3.0. I just got back into it using 6 and I noticed the rope will lag behind its attached rigidbody where it wouldnt in past versions.

Here is the imgur that contains the settings and gif of the rope lagging behind: https://imgur.com/a/DokBjAl

EDIT:
Unity 2020.3.3.0f1 LTS
Obi v6.4

Movement (physics):
Code:
private void FixedUpdate()
{
    Vector3 forcePoint = transform.position + transform.TransformDirection(moveForceOffset);
    Rigidbody.AddForceAtPosition(_targetForce, forcePoint, ForceMode.Force);
}



RE: Rope Lagging Behind Attachment - josemendez - 08-03-2022

Hi!

Check that the rope isn't colliding against the balloon, as collisions might be forcing the rope out of it. See the last bit of:
http://obi.virtualmethodstudio.com/manual/6.3/pinconstraints.html

If that's the cause (hard to tell from the gif alone, I can't tell if the distance between the balloon and the rope changes as it moves or if it's just a parallax effect), the solution is simple: filter out collisions between the tip of the rope and the balloon. Note collision filtering has changed quite a lot since Obi 3.0, the old "phases" system has been since replaced with a much more versatile filtering system, see "collision filtering" in the "collisions" page:http://obi.virtualmethodstudio.com/manual/6.3/collisions.html


RE: Rope Lagging Behind Attachment - VirtualCucumber - 08-03-2022

Thanks for the tips, Jose! I went ahead and applied the masks / cats so no collisions would happen between the balloon and the rope but still no dice. 

From my perspective it seems the rope is updating after physics step. I tried various tweaks like changing the solver to after Fixed Update and some pin constraint tweaking but still nothing. 

Here is a gif of it with Obi 5, I did not have any problems with pins that I can think of in that version. 

I sent a PM to you through here that will have the project .zip if you want to see it for yourself  Sonrisa

EDIT:
Forgot Obi 5 video link - https://i.imgur.com/tWkaDW1.mp4


RE: Rope Lagging Behind Attachment - josemendez - 09-03-2022

Hi!

Thanks for sharing your project! thanks to it I was able to identify the issue: it's a problem with interpolation (doesn't happen when both solver and rigidbody interpolation are off). Luckily it's easy to fix: open up ObiFixedUpdater.cs and move line 67 to the top of the function, like this:

Quote:private void Update()
{
accumulatedTime += Time.deltaTime;

ObiProfiler.EnableProfiler();
Interpolate(Time.fixedDeltaTime, accumulatedTime);
 ObiProfiler.DisableProfiler();
}

The time passed to the Interpolate() function was one frame behind the actual time, resulting in attachments to interpolated rigidbodies lagging behind. Accumulating the frame time before passing it to the function is the right thing to do. Will include this fix in the next update.


RE: Rope Lagging Behind Attachment - VirtualCucumber - 09-03-2022

(09-03-2022, 09:21 AM)josemendez Wrote: Hi!

Thanks for sharing your project! thanks to it I was able to identify the issue: it's a problem with interpolation (doesn't happen when both solver and rigidbody interpolation are off). Luckily it's easy to fix: open up ObiFixedUpdater.cs and move line 67 to the top of the function, like this:


The time passed to the Interpolate() function was one frame behind the actual time, resulting in attachments to interpolated rigidbodies lagging behind. Accumulating the frame time before passing it to the function is the right thing to do. Will include this fix in the next update.

Thanks for the fast fix! I went ahead and applied it and works perfectly   Gran sonrisa