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

How to make my virtual camera zoom out?

Discussion in 'Cinemachine' started by Lil_Potatoe, Apr 5, 2021.

  1. Lil_Potatoe

    Lil_Potatoe

    Joined:
    Feb 2, 2021
    Posts:
    16
    Hey, so I want my virtual camera to zoom out when it activates an is trigger on a game object but I do not know how? I have tried to change my camera's orthographic size but it doesn't seem to work. Thank you in advance for helping
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,233
    You have to change the ortho size in the vcam, not in the main camera. Use vcam.m_Lens.OrthographicSize = bla;
     
  3. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,233
    Please paste your script here. I can't help you without context. On what line does the error occur?
    Press this button to insert code in your forum post, so that it gets formatted properly:
    upload_2021-4-6_16-24-14.png
     
  4. Lil_Potatoe

    Lil_Potatoe

    Joined:
    Feb 2, 2021
    Posts:
    16
    Ooh, I just solved the issue. I forgot to drag my virtual camera into my public variable. But now I have another question (sorry if I am asking too much). is there a way to make the transition from my default view to my zoomed out view smooth, like if you were actually zooming out on something in real life
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,233
    Make 2 vcams: one for the default view, and one for the zoomed view. When you want to zoom, activate the zoom vcam, and the CM Brain will automatically blend.
     
    gferrari and Lil_Potatoe like this.