Cinemachine
The Cinemachine ViewType allows the camera to be controlled by Unity’s Cinemachine. Cinemachine version 2.8.4 or later is required.
Setup
- Ensure you are using Cinemachine 3.0.1+.
- Download and import the Cinemachine integration package.
- Create a Cinemachine camera (through the Cinemachine toolbar). Ensure the CinemachineBrain component exists on the same GameObject as the Camera Controller.
- Perform the following steps if you are using a first person perspective:
- Create a new GameObject and add the Cinemachine Camera component.
- Add the First Person Cinemachine ViewType to the Camera Controller.
- Specify the Cinemachine Camera created in step 4.1 to the Cinemachine Camera field of the newly added ViewType.
- The Cinemachine Camera component should have the following properties:
- Tracking Target: The character’s head.
- Position Control: Orbital Follow
- Rotation Control: Pan Tilt
- The Cinemachine Orbital Follow component should have the following properties:
- Target Offset: (0, 0, 0)
- Position Damping: (0, 0, 0)
- Radius: 0
- The Cinemachine Camera Offset Extension should be added if the camera should change offsets when aiming.
- Your first person Cinemachine Camera should look similar to:
- Perform the following steps if you are using a third person perspective:
- Create a new GameObject and add the Cinemachine Camera component.
- Add the Third Person Cinemachine ViewType to the Camera Controller.
- Specify the Cinemachine Camera created in step 5.1 to the Cinemachine Camera field of the newly added ViewType.
- The Cinemachine Camera component should have the following properties:
- Tracking Target: your character
- Position Control: Orbital Follow
- Rotation Control: Rotation Composer
- The Cinemachine Orbital Follow component should have the following properties:
- Target Offset: (0, 0, 0)
- Radius: 4
- The Cinemachine Rotation Composer should have the following properties:
- Target Offset: 1.81
- The Cinemachine Camera Offset Extension component should be added if the camera should change offsets when aiming.
- Your third person Cinemachine Camera should look similar to:
Inspected Fields
Field of View
The field of view of the main camera.
Field of View Damping
The damping time of the field of view angle when changed.
Virtual Camera
The VirtualCamera that should activate when the ViewType is active.
Look Direction Distance
The distance that the character should look ahead.
Use Character Look Direction
Should the character’s forward direction be used for the look direction?
Camera Offset
The offset of the CameraOffset extension module.
Position Spring
The positional spring used for regular movement.
Rotation Spring
The rotational spring used for regular movement.
Secondary Position Spring
The positional spring which returns to equilibrium after a small amount of time (for recoil).
Secondary Rotation Spring
The rotational spring which returns to equilibrium after a small amount of time (for recoil).