Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Reset camera x and y axis on camera change

Discussion in 'Cinemachine' started by VincentAbert, Mar 29, 2021.

  1. VincentAbert

    VincentAbert

    Joined:
    May 2, 2020
    Posts:
    120
    Hello !

    I just made a simple scene where the active camera briefly changes from a third person free look rig to a static virtual camera, then back to the main third person rig. The issue is that when it gets back to the main free look cam, the y axis value is always 0 (despite being around a normal 0.5 when the first change happens), meaning it's at the bottom rig, looking up at the player in a ridiculous way. My question is then : is this normal ? if not, why is it happening and how can I fix it ?

    Thanks a lot !
     
  2. VincentAbert

    VincentAbert

    Joined:
    May 2, 2020
    Posts:
    120
    Just in case it wasn't clear, I made a quick screen capture :


    As you can see, the end position is very low, and I can't understand why.

    Thanks !
     
  3. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,153
    This can sometimes happen in FreeLook with InheritPosition and LookAt and Follow targets set to different points. Does it happen if you set the LookAt and Follow target to the same thing?
     
  4. VincentAbert

    VincentAbert

    Joined:
    May 2, 2020
    Posts:
    120
    Yes, exactly. The second camera actually doesn't have any target, as I just want to set its position/rotation manually in editor. So the only solution is to set the player as a target on both camera ?
    I have managed to mitigate it by putting the second camera a bit higher, as it then goes to a more reasonable angle, but it's a bit annoying as I can't choose the exact framing I would want.

    Thank you for your help,

    Vincent
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,153
    It has nothing to do with the second camera - only the FreeLook.

    The FreeLook's LookAt and Follow target need to be the same thing. Also (I forgot to mention) it's best that the target should not be at the feet of the player. That can cause this problem. Instead, make an invisible child object of the player and position it near the head. Use that as a target.
     
  6. VincentAbert

    VincentAbert

    Joined:
    May 2, 2020
    Posts:
    120
    Oh I see no the LookAt and Follow are the same then... I'll try the empty gameObject target then, thank you !