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

Question Blending CM Virtual Cameras With Code

Discussion in 'Cinemachine' started by UnityGuy1988, Aug 7, 2023.

  1. UnityGuy1988

    UnityGuy1988

    Joined:
    Jan 12, 2020
    Posts:
    24
    I would like to blend between two virtual cameras in accordance with the character's proximity to another gameobject. I have one camera which would act as the far camera, and one that will provide a more focussed view of the object in question. I was hoping there might be a way to manipulate the degree of camera blend through code, so that I could use the offset magnitude of the object from the player as a variable that dictates the state of blending between the near and far camera. Is this possible?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,147
    Indeed there is. Have a look at CinemachineMixingCamera. If implements a continuous blend, the weights of whose inputs you can control via script.
     
    UnityGuy1988 likes this.
  3. UnityGuy1988

    UnityGuy1988

    Joined:
    Jan 12, 2020
    Posts:
    24
    Great, thanks very much! I'll check it out.