Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Jitter of softbody when moving attachment
#2
(12-05-2023, 12:16 PM)luvjungle Wrote: Is there a way to move attachment's target in Update() without causing softbody to jitter?

If the softbody is updated in FixedUpdate - which is where physics should always be updated if you want consistent behavior -  it is not possible to get rid of jitter because Update is called at a variable frequency, while FixedUpdate is called at a fixed frequency.

Some frames Update will be called and FixedUpdate won't, some frames Update will be called and FixedUpdate will be called multiple times. As a result, some frames the attachment target will move but the softbody won't, and some frames the softbody will move more than the attachment, leading to jittering since they're updated at different times.

(12-05-2023, 12:16 PM)luvjungle Wrote: If my player moves in FixedUpdate() and Cinemachine Brain is set to FixedUpdate, there is no jitter, but the problem is that I can't use this setup (it breaks other stuff).

This is the correct setup, physics (and anything interacting with physics) should be updated in FixedUpdate.

Another possibility is to update physics in LateUpdate (using Obi Late Updater), but this of course makes the simulation dependant on the time passed between updates which is physically incorrect and should only be used as a last resort.

Unfortunately there's no way to get rid of jittering if you update things at different frequencies. You must either update everything in Update/LateUpdate, or update it in FixedUpdate.


kind regards,
Reply


Messages In This Thread
RE: Jitter of softbody when moving attachment - by josemendez - 12-05-2023, 12:36 PM