Search Unity

Swinging orbit camera

Discussion in 'Cinemachine' started by unity_Yc5fGs-ZLS-O4Q, Jan 10, 2019.

  1. unity_Yc5fGs-ZLS-O4Q

    unity_Yc5fGs-ZLS-O4Q

    Joined:
    Nov 23, 2018
    Posts:
    3
    I am developing a ship simulator. I am trying to create an orbit camera using a virtual camera with Orbital Transposer and Lock to Target With World Up.
    My problem is that if the ship roll the camera heading swings.
    I would like that the camera keeps the same heading as the ship.
     
  2. Adam_Myhill

    Adam_Myhill

    Joined:
    Dec 22, 2016
    Posts:
    342
    There's a few ways to do this. I'm not completely sure of all the rotations involved and what you want to inherit VS ignore but here are a few things to try:

    Experiment with different binding modes and, lesser so but worth giving a go, also cranking the damping way up on appropriate channels.
    upload_2019-1-10_9-32-1.png

    If that doesn't get you want you want, remember that it's often very good not to directly track the object - the ship - but some component which has a relationship to the ship.

    If you create a Target Group camera, you'll get a TargetGroup. These are super handy as they can be used to strip rotational information. Put your ship in the TargetGroup and have your camera follow that. You'll get positional information but none of the rotational. That's a handy trick for cases like this.
    upload_2019-1-10_9-36-25.png


    There's also the Constraints. You can setup relationships based on specific types of constraints, to create objects which inherit motion from other objects in ways which you may find desirable. You can then get the camera to target those objects.
    upload_2019-1-10_9-39-31.png


    As a rule of thumb, I almost never target objects directly with the camera. Almost always it's a TargetGroup or some empty object which is a child or has some other relationship to the thing the camera wants to follow.