Struct CameraState | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    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. Coirrections are not considered when making time-based calculations such as damping.

    The Final position and orientation is the comination of the raw values and their corrections.

    Inherited Members
    System.ValueType.Equals(System.Object)
    System.ValueType.GetHashCode()
    System.ValueType.ToString()
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Cinemachine
    Syntax
    public struct CameraState

    Fields

    kNoPoint

    This constant represents "no point in space" or "no direction".

    Declaration
    public static Vector3 kNoPoint
    Field Value
    Type Description
    Vector3

    Properties

    BlendHint

    These hints can be or'ed toether to influence how blending is done, and how state is applied to the camera

    Declaration
    public CameraState.BlendHintValue BlendHint { get; set; }
    Property Value
    Type Description
    CameraState.BlendHintValue

    CorrectedOrientation

    Orientation with correction applied.

    Declaration
    public Quaternion CorrectedOrientation { get; }
    Property Value
    Type Description
    Quaternion

    CorrectedPosition

    Position with correction applied.

    Declaration
    public Vector3 CorrectedPosition { get; }
    Property Value
    Type Description
    Vector3

    Default

    State with default values

    Declaration
    public static CameraState Default { get; }
    Property Value
    Type Description
    CameraState

    FinalOrientation

    Orientation with correction and dutch applied. This is what the final camera gets.

    Declaration
    public Quaternion FinalOrientation { get; }
    Property Value
    Type Description
    Quaternion

    FinalPosition

    Position with correction applied. This is what the final camera gets.

    Declaration
    public Vector3 FinalPosition { get; }
    Property Value
    Type Description
    Vector3

    HasLookAt

    Returns true if this state has a valid ReferenceLookAt value.

    Declaration
    public bool HasLookAt { get; }
    Property Value
    Type Description
    System.Boolean

    Lens

    Camera Lens Settings.

    Declaration
    public LensSettings Lens { get; set; }
    Property Value
    Type Description
    LensSettings

    NumCustomBlendables

    The number of custom blendables that will be applied to the camera.
    The base system manages but otherwise ignores this data - it is intended for extension modules

    Declaration
    public int NumCustomBlendables { get; }
    Property Value
    Type Description
    System.Int32

    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 { get; set; }
    Property 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 { get; set; }
    Property Value
    Type Description
    Vector3

    RawOrientation

    Raw (un-corrected) world space orientation of this camera

    Declaration
    public Quaternion RawOrientation { get; set; }
    Property Value
    Type Description
    Quaternion

    RawPosition

    Raw (un-corrected) world space position of this camera

    Declaration
    public Vector3 RawPosition { get; set; }
    Property 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 { get; set; }
    Property Value
    Type Description
    Vector3

    ReferenceUp

    Which way is up. World space unit vector.

    Declaration
    public Vector3 ReferenceUp { get; set; }
    Property Value
    Type Description
    Vector3

    ShotQuality

    Subjective estimation of how "good" the shot is. Larger values mean better quality. Default is 1.

    Declaration
    public float ShotQuality { get; set; }
    Property Value
    Type Description
    System.Single

    Methods

    AddCustomBlendable(CameraState.CustomBlendable)

    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.CustomBlendable b)
    Parameters
    Type Name Description
    CameraState.CustomBlendable 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.

    GetCustomBlendable(Int32)

    Get a custom blendable that will be applied to the camera.
    The base system manages but otherwise ignores this data - it is intended for extension modules

    Declaration
    public CameraState.CustomBlendable GetCustomBlendable(int index)
    Parameters
    Type Name Description
    System.Int32 index

    Which one to get. Must be in range [0...NumCustomBlendables)

    Returns
    Type Description
    CameraState.CustomBlendable

    The custom blendable at the specified index.

    Lerp(CameraState, CameraState, Single)

    Intelligently blend the contents of two states.

    Declaration
    public static CameraState Lerp(CameraState stateA, 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

    System.Single t

    How much to interpolate. Internally clamped to 0..1

    Returns
    Type Description
    CameraState

    Linearly interpolated CameraState

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023