Class CinemachineCamera
This behaviour is intended to be attached to an empty GameObject, and it represents a Cinemachine Camera within the Unity scene.
The CinemachineCamera will animate its Transform according to the rules contained in its CinemachineComponent pipeline (Aim, Body, and Noise). When the CM camera is Live, the Unity camera will assume the position and orientation of the CinemachineCamera.
A CinemachineCamera is not a camera. Instead, it can be thought of as a camera controller, not unlike a cameraman. It can drive the Unity Camera and control its position, rotation, lens settings, and PostProcessing effects. Each CM Camera owns its own Cinemachine Component Pipeline, through which you can provide the instructions for procedurally tracking specific game objects. An empty procedural pipeline will result in a passive CinemachineCamera, which can be controlled in the same way as an ordinary GameObject.
A CinemachineCamera is very lightweight, and does no rendering of its own. It merely tracks interesting GameObjects, and positions itself accordingly. A typical game can have dozens of CinemachineCameras, each set up to follow a particular character or capture a particular event.
A CinemachineCamera can be in any of three states:
- Live: The CinemachineCamera is actively controlling the Unity Camera. The CinemachineCamera is tracking its targets and being updated every frame.
- Standby: The CinemachineCamera is tracking its targets and being updated every frame, but no Unity Camera is actively being controlled by it. This is the state of a CinemachineCamera that is enabled in the scene but perhaps at a lower priority than the Live CinemachineCamera.
- Disabled: The CinemachineCamera is present but disabled in the scene. It is not actively tracking its targets and so consumes no processing power. However, the CinemachineCamera can be made live from the Timeline.
The Unity Camera can be driven by any CinemachineCamera in the scene. The game logic can choose the CinemachineCamera to make live by manipulating the CM camerass enabled flags and/or its priority, based on game logic.
In order to be driven by a CinemachineCamera, the Unity Camera must have a CinemachineBrain behaviour, which will select the most eligible CinemachineCamera based on its priority or on other criteria, and will manage blending.
Inheritance
Implements
Inherited Members
Namespace: Unity.Cinemachine
Assembly: solution.dll
Syntax
[DisallowMultipleComponent]
[ExecuteAlways]
[AddComponentMenu("Cinemachine/Cinemachine Camera")]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.cinemachine@3.0/manual/CinemachineCamera.html")]
public sealed class CinemachineCamera : CinemachineVirtualCameraBase, ICinemachineCamera
Fields
Name | Description |
---|---|
BlendHint | Hint for transitioning to and from this CinemachineCamera. Hints can be combined, although not all combinations make sense. In the case of conflicting hints, Cinemachine will make an arbitrary choice. |
Lens | Specifies the LensSettings of this camera. These settings will be transferred to the Unity camera when the CM Camera is live. |
Target | The Tracking and LookAt targets for this camera. |
Properties
Name | Description |
---|---|
Follow | Get the current Follow target. Returns parent's Follow if parent is non-null and no specific Follow defined for this camera |
LookAt | Get the current LookAt target. Returns parent's LookAt if parent is non-null and no specific LookAt defined for this camera |
State | The current camera state, which will applied to the Unity Camera |
Methods
Name | Description |
---|---|
ForceCameraPosition(Vector3, Quaternion) | Force the CinemachineCamera to assume a given position and orientation |
GetCinemachineComponent(Stage) | Get the component set for a specific stage in the pipeline. |
GetMaxDampTime() | Query components and extensions for the maximum damping time. |
InternalUpdateCameraState(Vector3, float) | Internal use only. Called by CinemachineCore at designated update time so the vcam can position itself and track its targets. |
OnTargetObjectWarped(Transform, Vector3) | This is called to notify the CinemachineCamera that a target got warped, so that the CinemachineCamera can update its internal state to make the camera also warp seamlessly. |
OnTransitionFromCamera(ICinemachineCamera, Vector3, float) | Handle transition from another CinemachineCamera. InheritPosition is implemented here. |