Search Unity

FreeLook Camera Wobble only on BottomRig

Discussion in 'Cinemachine' started by argh6543, Nov 13, 2020.

  1. argh6543

    argh6543

    Joined:
    Apr 14, 2017
    Posts:
    48
    I use a CinemachineFreeLook camera with my a 3rd person camera controller. The controller tries to align the player with the camera so if you move the camera one direction while the character runs, the character slowly turns until he's heading in the same direction as the camera is now pointing. I achieve that by calculating the angle I should be rotating the player, add angle to the player transform y rotation, and then subtract the same angle from m_XAxis.Value.

    This works great except one issue: I get wobble where the camera bounces left and right a few frames after the move movement ends.

    What is strange about it is that this only occurs when the camera is on the BottomRig. When looking level or down (Middle or TopTig) I get absolutely no jitter. To make things weirder, I changed the BottomRig to be identical to the TopRig and this still happens. I get exactly the same view angle from Top and BottomRig, but the wobble only occurs if the BottomRig is active. All settings for the rigs are identical...

    Unity 2020.1.13f1 with Cinemachine 2.6.3
     
  2. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    Could you send us a project where we can reproduce the problem?
     
  3. argh6543

    argh6543

    Joined:
    Apr 14, 2017
    Posts:
    48
    Hi,

    can you please take a look at this zip file? http://www.loonybin.org/unity/CamFail.zip

    I stripped down the code as much as possible, so there is nothing more than a cube that's trying to slowly adjust itself so it's always facing the camera, no matter how you look at the camera. Works great in the middle rig, but not in the other.
     
  4. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    Your script (PlayerFaceing.cs) is fighting with Freelook's binding mode: Lock To Target With World Up binding mode. This causes the jitter.

    To fix:
    • Change Freelook's binding mode to World Space.
    • Comment out the last line of your script.
      freeLook.m_XAxis.Value -= dy;
     

    Attached Files:

    Gregoryl likes this.
  5. argh6543

    argh6543

    Joined:
    Apr 14, 2017
    Posts:
    48
    THANK YOU!!!

    This was one of the bugs we had for a while and always put it off since it wasn't bad enough to make the game unplayable and I could never find an easy answer. Thank you!