Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

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

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

  1. SirChick

    SirChick

    Joined:
    Feb 27, 2013
    Posts:
    317
    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:
    1,636
    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. SirChick

    SirChick

    Joined:
    Feb 27, 2013
    Posts:
    317
    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:
    1,636
    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.