Search Unity

Bug guys, SERIOUSLY....how do I stop this camera Jitter?

Discussion in 'Cinemachine' started by QbAnYtO, Sep 27, 2022.

  1. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    223
    I've tried everything I know.
    removing damping, rigid body to interpolate, extrapolate, blood of my first born. NOTHING is working.

    projectiles and player and moving object (traffic cars, Missles, walking npc/s, etc) everything that is moving is jittering when rotating or just moving (following player) any of these cameras.
    I've been reading soooo many forums' posts/questions about this and I can't find a fix.

    I am using cinemchine freelook with additional vCams.

    PLEASE HALP
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    There are many possible causes of jitter, and it could be that you have more than one of them so it seems like nothing works. The first step in solving it is to figure out the source. Can you post a video of the issue?
     
    ExtinctVenom likes this.
  3. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    223

    Here is the video link


    notice the missle how it jitters. I’m using playmaker and I already posted over there for answer but I should be able to get Aiken pointers here in unity’s forum.

    This also happens when I’m driving near other cars. To the static trees, basically everything as long as the camera is moving. If the camera is still, no jitter. Moving cars and missles are fine.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    To me this looks like aliasing problems between things being animated on the render clock (update) and things being animated on the physics clock (fixedUpdate).

    Can you say something about how the car is being moved? FixedUpdate? Update?

    Also the missile. I'm guessing that it has a RigidBody. How are you propelling it? Can you show the inspector for the missile?
     
    Last edited: Sep 28, 2022
  5. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    223
    I suspect is has something to do with the clock.
    So my vehicle moves in fixed. cinemachine brain is in smart update with late update blending.

    Missle moves with “follow player” action. All rigidbodies including missles have interpolate. Should I try changing the time step from 0.02 to something quicker? Gonna keep trying to fix this as I wait for hurricane Ian
     
  6. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    223
    Oh wow I changed the time step and that seems to have fixed it! Awesome. I’m sure I’ll have to adjust some of the physics now
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    If it gets better when you change the timestep, then that supports the hypothesis that this is an aliasing issue. Changing the timestep is not a robust fix, however. We should continue to look for the source of this problem, and fix it properly.

    Why is your vehicle moving in fixed? Can you change it to move in Update()?
     
    Last edited: Sep 28, 2022
  8. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    223

    Incan try. It’s from an asset. I will tinker with the code to see if i Can change it to update. The jitter is there but barely noticeable. I do prefer a more proper fix.
     
  9. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    The main thing to understand is that all your moving objects have to move on the same clock as the camera, or you will get jitter in the objects that move on the wrong clock.

    In RigidBodies - provided that their motion is done correctly - Interpolation converts the FixedUpdate motion to Update motion, by appropriately interpolating between fixed frames an applying the result to the transform. If you are doing that and want to keep it (which is a good idea) then you'll need to ensure that the car (and everything else that the camera might see) also moves in Update.

    The CM camera, if it's targeting the car and and the Brain is set to SmartUpdate, will auto-detect how the car is moving and update on the same clock. It will report its update mode when the game is playing, in the VirtualCamera inspector next to the Solo button (it will say "FixedUpdate"' or "LateUpdate"). Use that to help debug the car's motion.
     
  10. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    223

    Thanks for the details. I knew all this but I couldn’t pinpoint why it wasn’t working.

    but thanks to your spark, I revistes the idea of editing the car controller code. I found the section I had to edit. I changed it from fixedUpdate to update and the jitter is completely gone. Thanks!

    I will run more testing.
    My character controller may have some jitter too but I’m not 100% sure. I’ll report back.


    As far as the vehicle, missles, objects goes, no more jitter :)

    I also put the time step
    Back to .02 (where it was originally) and still no jitter.
     
    Gregoryl likes this.