Search Unity

Keep two moving targets in view at fixed position in screen space for orthographic top down camera.

Discussion in 'Cinemachine' started by eodeveloper, Jul 17, 2019.

  1. eodeveloper

    eodeveloper

    Joined:
    Feb 23, 2018
    Posts:
    5
    Hello,
    I'm developing a map system where the camera is following the player movement . The player destination can be set by clicking on different points of the map. The view is top down, with an orthographic camera.

    I'm trying to achieve a certain behaviour where once we've set a new destination for the player, both the player and its destination stay at fixed positions in screen space while the player is moving towards its destination,

    with the player centered at the bottom of the screen, and the destination centered at the top of the screen.

    So essentially I'm trying to keep the elements of a target group within a narrow, centered vertical frame. But i need to add some roll on my camera, so that the targets stay in a vertical line in the view.

    Is that something achievable with out of the box cinemachine components?

    Thanks.
     
    Last edited: Jul 17, 2019
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    You can get it out-of-the-box with the exception of the roll. For that, you'll need to write a custom CinemachineExtension to tweak the vcam's rotation to align it with the player-target axis.
     
  3. eodeveloper

    eodeveloper

    Joined:
    Feb 23, 2018
    Posts:
    5
    Hey there,
    Thanks for the prompt answer. I will get back here after I spend some time trying to figure it out if I'm still having difficulties.
    cheers