Search Unity

Damping on freelook camera cause shakings

Discussion in 'Cinemachine' started by SrNull, Jan 9, 2019.

  1. SrNull

    SrNull

    Joined:
    Jun 9, 2011
    Posts:
    18
    When I set Damping in any ring of the Cinemachine Freelook Camera, the camera follows with jerking movements, is not smooth .
    If I set the Damping values to zero, the shakings stops.
    I attach a Gif of what it looks.
    How can I solve this? or is something that it will be fixed in next patches?
    Thanks,
     

    Attached Files:

  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,501
    This looks like a clock mismatch. If your character is being animated on one clock (e.g. FixedUpdate), and your camera is being updated on another (e.g. LateUpdate), then you will get this kind of artifact.

    How is the character being animated?
    What is the Update Mode of the Brain?
    In Play mode, when the character is moving and showing these problems, what does it say on the vcam inspector next to the Solo button (LateUpdate or FixedUpdate)?
     
  3. SrNull

    SrNull

    Joined:
    Jun 9, 2011
    Posts:
    18
    Oh you are right, the character´s rigidbody is moved on FixedUpdate(), so I changed the update method on the cinemachine brain from "smart update" to "fixed update" and now it moves smoothly.
    Thanks !
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,501
    Wait a minute - SmartUpdate should work in that case. It's supposed to detect how the target moves and update the vcam the same way. Do you have interpolation on the target, or are you also altering its transform (or its parent) somewhere in Update or LateUpdate? In that case the vcam will update in LateUpdate (and will show that in the inspector - can you check?)
     
  5. SrNull

    SrNull

    Joined:
    Jun 9, 2011
    Posts:
    18
    Yes, I do a "transform.rotation = Quaternion.Slerp(_,_,_)" in the Update(),
    and then I do the "Rigidbody.MovePosition( dir)" in the FixedUpdate().
    -In this scenario, Smart Update is set to "Late Update" and causes the artifact,

    If I comment the "transform.rotation = Quaternion.Slerp(_,_,_)" ; Smart Update is set to Fixed Update and artifact disappears. ( but i need do the transform.rotation)

    Smart Update works well when I put all that code in the same Fixed Update segment.
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,501
    Perfect. That sounds like the right solution.