Search Unity

changing what the camera is looking at

Discussion in 'Cinemachine' started by puddleglum, Jan 16, 2021.

  1. puddleglum

    puddleglum

    Joined:
    May 11, 2020
    Posts:
    412
    how would i change what the cinimachine camera is looking at using a script? i need it to move from one section to another when a player hits a trigger box but i dont know how to change what its looking at from within a script.
     
  2. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    Code (CSharp):
    1. // CinemachineVirtualCamera vcam
    2. vcam.m_Follow = newFollowTransform;  // Determines the position of your vcam
    3. vcam.m_LookAt = newLookAtTransform;  // Determines the rotation of your vcam
     
  3. puddleglum

    puddleglum

    Joined:
    May 11, 2020
    Posts:
    412
    Awesome thanks