Search Unity

Help! My Cinemachine is tracking my player with jitter

Discussion in 'Cinemachine' started by TheFesler, Jan 31, 2022.

  1. TheFesler

    TheFesler

    Joined:
    May 6, 2021
    Posts:
    11
    So I am using a FreeLook camera with update method smart and blend update mode late, I am running my characters movement in Update(). I tried running my players movement in fixed update and doing the same on the camera, the it was only jittery when I jumped, and I noticed that in none of my tries the camera movement speed was the same across different fps.
    Please tell me if I didn't make me understod!
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    What version of CM are you using?
     
  3. TheFesler

    TheFesler

    Joined:
    May 6, 2021
    Posts:
    11
    I am using CM version 2.6.11
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Jittery movement is usually a sign that the character is not being animated smoothly. If you are using RigidBodies for your character, a good way to keep it smooth is to apply physics forces in FixedUpdate (don't modify the transform directly - le the physics system do the work). Turn on interpolation for the RigidBody, and run the camera system in SmartUpdate. If all is working properly, then the vcams will update in LateUpdate, which means that they're tracking the interpolated position of the rigidbody - which is what you want.

    upload_2022-2-14_8-2-30.png

    If you're not using RigidBodies, then you should animate your character in Update() exclusively, paying careful attention to account for deltaTime, which will be different every frame.
     
  5. TheFesler

    TheFesler

    Joined:
    May 6, 2021
    Posts:
    11
    Yes, this fixes the jittery movement, but it doesn't solve the problem that the camera moves at different speeds across different FPS.
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    It should solve it. Can you elaborate on the problem you're experiencing? Perhaps you can make a lightweight sample project that shows the issue.
     
  7. TheFesler

    TheFesler

    Joined:
    May 6, 2021
    Posts:
    11
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    How have you set up the input? Can you show the inspector? Input package or legacy input?
     
  9. TheFesler

    TheFesler

    Joined:
    May 6, 2021
    Posts:
    11
    I am using the new input system, as you can see
     

    Attached Files:

  10. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Input response is supposed to be the same regardless of FPS.
    Can you show the vcam inspector?
    Is it updating in FixedUpdate or LateUpdate? (you can tell by entering Play mode and looking at the indicator on the vcam inspector, next to the Solo Button).
     
  11. TheFesler

    TheFesler

    Joined:
    May 6, 2021
    Posts:
    11
    I think Vcam is virtual camera inspector, but I am using a FreeLook camera, or maybe it's the same thing.
    So it's running on late update.
     

    Attached Files:

    • kj.png
      kj.png
      File size:
      271.3 KB
      Views:
      245
    • ljhb.png
      ljhb.png
      File size:
      273.1 KB
      Views:
      248
    Gregoryl likes this.
  12. antoinecharton

    antoinecharton

    Unity Technologies

    Joined:
    Jul 22, 2020
    Posts:
    189
    Try changing the input handling in the settings (Edit - Project Settings - Input System Package) from fixed update to dynamic update.
    Let us know if this works for you.
     
    kaancetinkayasf and Gregoryl like this.
  13. TheFesler

    TheFesler

    Joined:
    May 6, 2021
    Posts:
    11
    I found out that I had to create a new asset to change the settings, I did that, but I couldn't find the setting you mentioned(input handling)
     

    Attached Files:

  14. TheFesler

    TheFesler

    Joined:
    May 6, 2021
    Posts:
    11
    Are you still working on potential fixes? I would like to know
     
  15. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Did changing the mode to DynamicUpdate help? Make sure you have the latest version of the Input package.
     
  16. TheFesler

    TheFesler

    Joined:
    May 6, 2021
    Posts:
    11
    No, Fixed and Dynamic update didn't make a difference. There is no jitter but different camera sensitivity across different FPS. Sorry for late response
     
  17. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Likewise sorry for the late response from me. There is a bug in the input package that was fixed but not released yet.
     
  18. TheFesler

    TheFesler

    Joined:
    May 6, 2021
    Posts:
    11
    Should I just wait for it to be released then?
     
  19. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730