Search Unity

Roating a Vcam around a target for "follow" creates jitter for framing transposer

Discussion in 'Cinemachine' started by TheCelt, May 30, 2019.

  1. TheCelt

    TheCelt

    Joined:
    Feb 27, 2013
    Posts:
    742
    Hi

    I have my Vcam with a script attatched that has this piece of code:


    Code (CSharp):
    1. if(_canYaw)
    2. transform.RotateAround(_camera.Follow.transform.position,_camera.Follow.up,_yawSpeed * dX);
    3.  
    4. Vector3 e = transform.eulerAngles;
    5. e.x -= _canPitch ? _pitchSpeed * dY : 0;
    6. e.x = Mathf.Clamp(e.x, _minPitchAngle, _maxPitchAngle);
    7. transform.eulerAngles = e;
    But the issue is everything jitters, as its following the object and i'm rotating it with my mouse. The only fix is setting everything to zero in the framing transposer but then i lose the follow smoothness on the object.

    How can i get this to work properly?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Try adding vcam.PreviousStateIsValid = false. Let me know if that helps.
     
  3. TheCelt

    TheCelt

    Joined:
    Feb 27, 2013
    Posts:
    742
    Do i put this in Update for every frame or is it a one time flag?
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Only when you rotate. It will cancel the damping for that frame only.
     
  5. TheCelt

    TheCelt

    Joined:
    Feb 27, 2013
    Posts:
    742
    That did the trick, thanks ! :)
     
    Gregoryl likes this.