Search Issue Tracker

By Design

Votes

0

Found in [Package]

2.7.1

Issue ID

1301053

Regression

No

CinemachineFreeLook Camera jitters when it is controlled by InputValues and UpdateMethod is set to FixedUpdate

Package: Cinemachine

-

Reproduction steps:
1. Open user's attached project and Scenes/test scene
2. In the Hierarchy window, select Camera
3. In the Inspector, expand the CinemachineBrain component
4. Set the Update Method and Blend Update Method to Fixed Update
5. Enter the Play mode
6. Move the mouse and observe the Game view

Expected result: Camera moves smoothly
Actual result: Camera jitters

Reproducible with: 2.6.0-preview.8 - 2.7.1 (2019.4.17f1, 2020.2.2f1, 2021.1.0b2)
Could not test with: 2018.4.30f1(error when downgrading)

  1. Resolution Note:

    User error.

    The code in Character.Update() supplied in the project is assuming a fixed deltaTime, which does not correctly account for deltaTime variability, so will always produce jitter. Moving that code to FixedUpdate eliminates this problem.

    To get smooth camera tracking, the camera must update on the same clock (Update or FixedUpdate) as the thing it's tracking.  The SmartUpdate mode of the CM Brain analyzes the movement of the target (by "movement" here we mean: it's transform changes) and updates the camera on the same clock as the target.  You can check this by playing the game and looking at the FreeLook inspector: in playmode, it indicates the update clock it's using, next to the Solo button.

    Changing the CM Brain's update mode to FixedUpdate won't remove the jitter unless you _also_ change Character.cs to do its work in FixedUpdate() instead of Update().

    Note that if the character's transform changes in _both_ Update() and FixedUpdate(), you will not get good results because there will be no way for a camera to track that smoothly. You must choose one clock or the other.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.