Search Unity

Is there a way to make 180 x-axis movement look smoother on Cinemachine?

Discussion in 'Cinemachine' started by ynm11, Jan 29, 2022.

  1. ynm11

    ynm11

    Joined:
    Jul 6, 2021
    Posts:
    57
    I love Cinemachine so far!
    I have a FreeLook camera with binding "Lock To Target On Assign", and I have a script that makes player rotation affected by camera rotation.

    Code (CSharp):
    1. moveDirection = (Quaternion.AngleAxis(cameraTransform.rotation.eulerAngles.y, Vector3.up) * moveDirection).normalized;
    Anyway, the only issue I am having is that when my character does a sudden 180 turn on x-axis, the Camera looks like it 'jolts' to instantly shift with it.

    Gif of this:
    https://i.imgur.com/qn6lFDz.mp4

    Turning on "Horizontal Damping" for each Rig works for this, but is there a way to create this damping behavior via script? Because I will only need to turn on that damping for the circumstance of player doing quick keypress, but otherwise will not want the damping on that high.
    Otherwise is there an alternative recommended solution?
    Thanks!
     
    Last edited: Jan 29, 2022
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,725
    Sorry for the slow response
    .
    Looking at your gif, it seems to me that putting the LookAt point in the center of your character's head (instead of on the face) will solve the problem.
     
    ynm11 likes this.