Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Cinemachine Virtual Camera Transition between objects while keeping dead zone

Discussion in 'Cinemachine' started by RARgames, Nov 6, 2019.

  1. RARgames

    RARgames

    Joined:
    Aug 25, 2017
    Posts:
    39
    - 3d game
    - 2 game objects: A and B. (both spawned on runtime)

    I want to get a smooth transition from object A to B, but only if, the object B is outside vcam's dead zone.
    Vcam should look at the object with static rotation. (only the camera position should change)

    I assume that I have to use:
    • Follow property - because it only affects vcam transform
    • Framing Transposer - to use dead zones in body component

    I've tried spawning new vcam with B and disabled the first vcam - this gives smooth transition between cameras, but it does it always, even if A and B are inside dead zones of 1st and 2nd vcam.

    How can I achieve smooth camera transition between 2 game objects only if the new one is outside the dead zone of previous vcam?

    I know that I can do it by moving object followed by vcam from A to B and this should work with dead zones, but I'm looking for cleaner solution if it's possible
     
    Last edited: Nov 6, 2019
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    CM doesn't give you a notification when things go in and out of dead zones. You can accomplish what you're looking for by polling the position of B relative to the camera (use the main camera, the one with the Brain) and manually calculating whether the angle between CameraPosToB and CameraForward is sufficiently large, and activating the second vcam when it is.
     
    Last edited: Nov 7, 2019
    RARgames likes this.