Search Unity

Cinemachine jitter when rotating target

Discussion in 'Cinemachine' started by Ondrej98, Sep 16, 2019.

  1. Ondrej98

    Ondrej98

    Joined:
    Oct 18, 2016
    Posts:
    21
    Hello,

    I have been trying to make camera follow my player smoothly with both my own script, and cinemachine but it's always jittery. I have reduced the problem to following example, this is my setup: upload_2019-9-16_14-59-27.png
    upload_2019-9-16_14-59-48.png
    upload_2019-9-16_15-0-35.png

    Rotator script is just this:
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3.  
    4. public class Rotator : MonoBehaviour
    5. {
    6.     void Update()
    7.     {
    8.         transform.Rotate(Vector3.up, 150 * Time.deltaTime, Space.Self);
    9.     }
    10. }
    11.  
     

    Attached Files:

  2. toomasio

    toomasio

    Joined:
    Nov 19, 2013
    Posts:
    198
    Try hard locking body to target in the body settings.
     
  3. Ondrej98

    Ondrej98

    Joined:
    Oct 18, 2016
    Posts:
    21
    No jittering but I need the smoothing...
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    It's because of an unsteady frame rate. Try changing your script to animate in FixedUpdate() instead of Update().
     
  5. Ondrej98

    Ondrej98

    Joined:
    Oct 18, 2016
    Posts:
    21
    Thanks a lot that fixed it.
     
    Gregoryl likes this.