Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Controlling the camera movement. Where do i put the script?

Discussion in 'Cinemachine' started by TheCelt, Jul 31, 2018.

  1. TheCelt

    TheCelt

    Joined:
    Feb 27, 2013
    Posts:
    741
    Hi

    If i want to make a camera controller script to control the movement of my virtual cameras, do i still put this script on the main camera and that will auto move the virtual camera, or the virtual camera has to have the controller ?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    You want to move the virtual cameras, not the main camera. Make sure the vcam has "Do Nothing" in aim and body, so it won't try to procedurally animate its own transform. The brain on the main Camera will then position itself according to the currently active vcam.

    So, in summary, your controller is attached to the vcam. The main camera is a separate GameObject, and has a CinemachineBrain component which tracks the vcam.
     
  3. TheCelt

    TheCelt

    Joined:
    Feb 27, 2013
    Posts:
    741
    Okay thanks.

    Follow up on your first point, will there be issues if i have a script controlling the movement of the VCam but the VCam has a look at target?
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    Not if you put Do Nothing in the Aim. It's a good idea to set the LookAt target, because it informs the blender about what's important to keep in the frame.

    However, if your controller is a POV-type, without a specific LookAt target, then it's better to leave LookAt blank because that's more accurate. Otherwise, the blender might make some strange-seeming decisions.