Search Unity

Reset Starting Camera Position and Rotation

Discussion in 'Cinemachine' started by wlad_s, Dec 27, 2019.

  1. wlad_s

    wlad_s

    Joined:
    Feb 18, 2011
    Posts:
    148
    Hello,

    I couldn't find a solution to the problem I have.

    My Chase vCam follows an airplane, Body: transposer with yaw and pitch damping, Aim: composer.

    I have a quick reset function that instantly positions and rotates the airplane to the starting position.

    Now, if I rotate the airplane for an example upwards to point to the sky, and hit reset, it resets fine but my camera smoothly rotates to the new rotation because of the yaw/pitch/roll damping. But I want to reset the camera instantly just as I did the airplane. Is it possible? Is there a function to clear all the internal vcam calculations and set the new camera rotation and start over from there?

    I can solve this by setting dampings to zero, wait for a frame and set them back, but it's kinda hacky.

    Unity 2019.1.12
    Cinemachine 2.3.4

    Thanks!
     
    Last edited: Dec 29, 2019
  2. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
  3. wlad_s

    wlad_s

    Joined:
    Feb 18, 2011
    Posts:
    148
    Oh, that might work. I'm already using that function for teleporting.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    christougher likes this.
  5. wlad_s

    wlad_s

    Joined:
    Feb 18, 2011
    Posts:
    148
    OnTargetObjectWarped() didn't work for rotation dampings (Pitch, Yaw and Roll), only for position. So I just solved it with a hacky coroutine. But I'll try vcam.PreviousStateIsValid = false when I get back to that problem, thanks for the suggestion.