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

Change "Hard Look At" Up axis

Discussion in 'Cinemachine' started by Pomperi, Sep 21, 2020.

  1. Pomperi

    Pomperi

    Joined:
    Sep 3, 2013
    Posts:
    4
    Hi,

    I'm trying to set up a dolly track with a LookAt target for my project and I've run into a problem that I'm not able to resolve. I'm making a top-down game with 2D collision and 3D art, which means my entire game is built rotated 90 degrees, effectively making the Z axis the up axis instead of the default Y axis. As a result I'm getting a roll instead of a yaw when the camera pans around the tracked target.

    This is what it currently looks like when I'm trying to pan using LookAt: https://media1.giphy.com/media/mg2Ew3lAXGPpVK2XqA/giphy.gif

    Is there any way to change the up axis of my virtual camera, or perhaps any way to work around this limitation? The "Hard Look At" option only seems to be in world space with no options to change the up axis.

    Would be super grateful for any suggestions!

    EDIT: After looking a bit further, I realized I could add a Cinemachine Brain to the the virtual camera and assign a custom transform for the up axis! It seemed to do the trick for me :)
     
    Last edited: Sep 21, 2020
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    It's possible in Cinemachine to globally override world Up. Point this field to a GameObject that has the desired orientation (in your case this would be an object rotated so that its local Y axis points towards world Z):

    upload_2020-9-21_9-34-35.png
     
  3. Pomperi

    Pomperi

    Joined:
    Sep 3, 2013
    Posts:
    4
    Hey, thanks for the reply :)
    Stumbled upon this just a few seconds before your reply. That's a super useful feature!

    Cheers!