Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Cinemachine virtual camera: lock camera position

Discussion in 'Cinemachine' started by nikita-v-fedorov, Apr 12, 2024.

  1. nikita-v-fedorov

    nikita-v-fedorov

    Joined:
    Jun 15, 2022
    Posts:
    6
    I have two virtual cameras with the same position but different lookAt targets. When they look into more or less opposite directions and then I blend from one into another, not only the rotation gets blended, but also the position. It goes by a full circle which is not desirable behaviour.
    I set up the blend hint to cylindrical position which removed the Y position change, but X and Z still remain. How can I prevent the camera position to get blended?
    1.
    upload_2024-4-12_11-4-29.png

    2.
    upload_2024-4-12_11-3-2.png
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,838
    It's because they are using cylindrical blending while looking at different targets. The cylindrical algorithm interpolates the target position and camera distance from target, which will result in the circular path you describe. Change the blend hints to "None" or perhaps to "Screen Space Aim when Targets Differ".
     
    Last edited: Apr 12, 2024
  3. nikita-v-fedorov

    nikita-v-fedorov

    Joined:
    Jun 15, 2022
    Posts:
    6
    That's odd...the initial hint was None, but I also already tried "Screen Space Aim when Targets Differ". But the thing is now that it works...
    Thank you :)
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,838
    Both cameras can have hints. If one of them requests Cylindrical but not the other, Cylindrical wins.