Struct CameraState
The output of the Cinemachine engine for a specific virtual camera. The information in this struct can be blended, and provides what is needed to calculate an appropriate camera position, orientation, and lens setting.
Raw values are what the Cinemachine behaviours generate. The correction channel holds perturbations to the raw values - e.g. noise or smoothing, or obstacle avoidance corrections. Corrections are not considered when making time-based calculations such as damping.
The Final position and orientation is the combination of the raw values and their corrections.
Inherited Members
Namespace: Unity.Cinemachine
Assembly: Unity.Cinemachine.dll
Syntax
public struct CameraState
Fields
BlendHint
Combine these hints to influence how blending is done, and how state is applied to the camera.
Declaration
public CameraState.BlendHints BlendHint
Field Value
Type | Description |
---|---|
CameraState.BlendHints |
Lens
Camera Lens Settings.
Declaration
public LensSettings Lens
Field Value
Type | Description |
---|---|
LensSettings |
OrientationCorrection
Orientation correction. This will be added to the raw orientation. This value doesn't get fed back into the system when calculating the next frame. Can be noise, or smoothing, or both, or something else.
Declaration
public Quaternion OrientationCorrection
Field Value
Type | Description |
---|---|
Quaternion |
PositionCorrection
Position correction. This will be added to the raw position. This value doesn't get fed back into the system when calculating the next frame. Can be noise, or smoothing, or both, or something else.
Declaration
public Vector3 PositionCorrection
Field Value
Type | Description |
---|---|
Vector3 |
RawOrientation
Raw (un-corrected) world space orientation of this camera
Declaration
public Quaternion RawOrientation
Field Value
Type | Description |
---|---|
Quaternion |
RawPosition
Raw (un-corrected) world space position of this camera
Declaration
public Vector3 RawPosition
Field Value
Type | Description |
---|---|
Vector3 |
ReferenceLookAt
The world space focus point of the camera. What the camera wants to look at. There is a special constant define to represent "nothing". Be careful to check for that (or check the HasLookAt property).
Declaration
public Vector3 ReferenceLookAt
Field Value
Type | Description |
---|---|
Vector3 |
ReferenceUp
Which way is up. World space unit vector. Must have a length of 1.
Declaration
public Vector3 ReferenceUp
Field Value
Type | Description |
---|---|
Vector3 |
RotationDampingBypass
This is a way for the Body component to set a bypass hint for aim damping, useful for when the body needs to rotate its point of view, but does not want interference from the aim damping. The value is the amount that the camera has been rotated, in world coords.
Declaration
public Quaternion RotationDampingBypass
Field Value
Type | Description |
---|---|
Quaternion |
ShotQuality
Subjective estimation of how "good" the shot is. Larger values mean better quality. Default is 1.
Declaration
public float ShotQuality
Field Value
Type | Description |
---|---|
float |
kNoPoint
This constant represents "no point in space" or "no direction".
Declaration
public static Vector3 kNoPoint
Field Value
Type | Description |
---|---|
Vector3 |
Properties
Default
State with default values
Declaration
public static CameraState Default { get; }
Property Value
Type | Description |
---|---|
CameraState |
Methods
AddCustomBlendable(Item)
Add a custom blendable to the pot for eventual application to the camera. The base system manages but otherwise ignores this data - it is intended for extension modules
Declaration
public void AddCustomBlendable(CameraState.CustomBlendableItems.Item b)
Parameters
Type | Name | Description |
---|---|---|
CameraState.CustomBlendableItems.Item | b | The custom blendable to add. If b.m_Custom is the same as an already-added custom blendable, then they will be merged and the weights combined. |
Lerp(in CameraState, in CameraState, float)
Intelligently blend the contents of two states.
Declaration
public static CameraState Lerp(in CameraState stateA, in CameraState stateB, float t)
Parameters
Type | Name | Description |
---|---|---|
CameraState | stateA | The first state, corresponding to t=0 |
CameraState | stateB | The second state, corresponding to t=1 |
float | t | How much to interpolate. Internally clamped to 0..1 |
Returns
Type | Description |
---|---|
CameraState | Linearly interpolated CameraState |