Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  MainCamera problem when tracking ObiRope
#1


Hello everyone!

I unfortunately have a problem with ObiRope and the MainCamera. As you can see in the video, the MainCamera is tracking the cabin, since it is a child of it. The four ropes are tied to the cabin (static start point), as well as to the object hanging below (dynamic end point). Now, when the crane moves in x- and/or y direction, there is this strong wobbly movement of the ropes.

I suspect that the problem might be that the camera is in the cabin and can't keep up with the ObiRope. On the other hand, I tried the same thing with a Cinemachine virtual camera and put the cabin in "Follow At". This unfortunately led to the same result. However, if you look at the situation in the Scene View or lock the camera to a position so that it no longer follows the cabin, you don't see any shake, at least at first glance.

Does anyone have a suggestion for a solution?

Thank you very much in advance!
I wish all of you a Merry Christmas and happy and escepecially healthy New Year!'

Best regards,
Alexej
Reply
#2
(23-12-2022, 05:12 PM)Alnik Wrote:

Hello everyone!

I unfortunately have a problem with ObiRope and the MainCamera. As you can see in the video, the MainCamera is tracking the cabin, since it is a child of it. The four ropes are tied to the cabin (static start point), as well as to the object hanging below (dynamic end point). Now, when the crane moves in x- and/or y direction, there is this strong wobbly movement of the ropes.

I suspect that the problem might be that the camera is in the cabin and can't keep up with the ObiRope. On the other hand, I tried the same thing with a Cinemachine virtual camera and put the cabin in "Follow At". This unfortunately led to the same result. However, if you look at the situation in the Scene View or lock the camera to a position so that it no longer follows the cabin, you don't see any shake, at least at first glance.

Does anyone have a suggestion for a solution?

Thank you very much in advance!
I wish all of you a Merry Christmas and happy and escepecially healthy New Year!'

Best regards,
Alexej

Hi Alexej!

How are you moving the cabin? physics in Unity are updated in FixedUpdate(), so if you move the cabin (and the camera) during Update(), they will be out of sync. This might cause the wobbling effect you see.
You might want to move the cabin only when the solver is updated, by subscribing to the solver’s OnBeginStep (see http://obi.virtualmethodstudio.com/manua...olver.html)

Note this also applies to rigidbodies, not just ropes. For this reason, following a rigidbody with a camera in Unity usually requires interpolating the rigidbody position or smoothing out camera movement.

Also, where’s the solver placed in this scene? If ropes are being simulated in the cabin’s local space (so the simulation space also moves with the cabin) you must be extra careful with the order in which things are updated (solver simulation, cabin/camera movement).

kind regards,
Reply
#3
Hello Jose,

Thank you very much for your answer.

The cabin is moved in the FixedUpdate(), but the idea with the OnBeginStep is very interesting, I would have to try it out.

Regarding the rigidbody, the cabin itself doesn't have one, if that's what you mean. The object that hangs on the ends of the rope does.

The solver is not a child of the cabin, it doesn't have a parent that it follows directly.

If I understand this correctly, the procedure would be to ask for the solver to be updated in the code before moving the cabin, right? If so, then I will try it out.

Thank you very much in advance!

Best regards,
Alexej
Reply