Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    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. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    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. :)