Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Sync Free Look Camera with Virtual Camera before transition

Discussion in 'Cinemachine' started by BrandStone, Sep 5, 2018.

  1. BrandStone


    Jul 21, 2014
    I have two cameras set up in my project. One is a Free look camera for over the shoulder and the other one is a target camera set to follow the player and look at one enemy.

    When I switch to target camera all is well: the virtual camera does the tracking, the fight goes on. But when I transition from the virtual camera back to the free look camera, the perspective will switch back to where the free look camera was before. But what I would like to achieve is to not see any transition between them.

    In the code I have a method that switches between free look and virtual camera.

    Code (CSharp):
    1. void ToggleTargetCamera ()
    2. {
    3.     this.hasTargetLock = !this.hasTargetLock;
    5.     if (this.hasTargetLock)
    6.     {
    7.         orbitCamera.Priority = 10;
    8.         targetCamera.Priority = 20;
    9.     }
    10.     else
    11.     {
    12.         // Sync cameras here
    13.         MakeOrbitCameraParamsAsTargetCamera();
    15.         orbitCamera.Priority = 20;
    16.         targetCamera.Priority = 10;
    17.     }
    18. }
    How could I achieve this?
  2. Gregoryl


    Unity Technologies

    Dec 22, 2016
    I'm assuming that "where the free look was before" refers to its position on the orbit? You want the axis value to be such that the camera moves as little as possible in the blend?

    You'll need to do 2 things to make this happen:
    1. Upgrade CM to 2.2.8 (not released yet, but available in preview on the staging repository)
    2. Check the "Inherit Position" checkbox on both vcams

    See this thread:
    BrandStone likes this.
  3. BrandStone


    Jul 21, 2014
    Oh yes, that's exactly what I need. Thanks, I'll check out 2.2.8. :)