Search Unity

Timeline + Cinemachine Stutter

Discussion in 'Cinemachine' started by RaventurnPatrick, Oct 8, 2020.

  1. RaventurnPatrick

    RaventurnPatrick

    Joined:
    Aug 9, 2011
    Posts:
    250
    Hi,
    I created a timeline where an object (lets say a car) is animated via Unity Animator (Animation) that changes the transform.
    At the same time i set up a cinemachine camera the follows this car. In the timeline i make the camera slowly zoom into the car.

    Now I have the problem that the cinemachine camera and the car are not synched and cause heavy stutter when the framerate is lower than 30FPS (say around 20-25FPS).
    If I animated the camera with Untiy Animations everything stays in sync and looks way smoother as a result.

    Is there any way to tell cinemachine to 100% lock to the object instead of "trying" to smooth it out?
    Both LateUpdate and FixedUpdate / SmartUpdate don't help to alleviate the problem.

    Is there a recommended way to combine Timeline with Cinemachine?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    There is no problem combining Cinemachine and Timeline if it's setup correctly.

    In Unity, there are 2 clocks: the physics clock (FixedUpdate) and the render clock (Update/LateUpdate). If you have a camera (Cinemachine or not) that is tracking something, it's important to animate both the camera and its target on the same clock, otherwise you may see judder. When you animate both the camera and the target with the Animator, then you are driving both from the same clock, so it will be fine. The challenge now is to make sure that Cinemachine uses the same clock as the animator.

    Animator animates on the Update clock (not the FixedUpdate clock) so you'll want the CM camera to animate that way also. Therefore you should use LateUpdate or SmartUpdate in the CM Brain. The choice depends on the context:
    • Do you have other CM vcams in the scene, outside of timeline?
    • If so, are they tracking physics-animated objects?
    • If you answered yes to both, choose SmartUpdate
    Another common cause for judder is inconsistent animation of the target. If the target doesn't move smoothly, it's impossible to get perfectly smooth camera movement:
    • Moving the camera smoothly when the target does not will produce a juddering target.
    • Locking the camera relative to the target will make the target smooth, but the background will judder.
    If you want Cinemachine to 100% lock on your target, just turn the damping to 0. There are several damping settings, depending on your vcam setup. Set all damping settings in both Body and Aim to 0. However, by doing this you are hiding the problem, not correcting it. The best thing would be to make sure the target animates smoothly, on a single clock (render or physics - not both). Then the cameras will be able to track it smoothly.