Class CinemachineFreeLook | Cinemachine | 2.5.0
docs.unity3d.com
    Show / Hide Table of Contents

    Class CinemachineFreeLook

    A Cinemachine Camera geared towards a 3rd person camera experience. The camera orbits around its subject with three separate camera rigs defining rings around the target. Each rig has its own radius, height offset, composer, and lens settings. Depending on the camera's position along the spline connecting these three rigs, these settings are interpolated to give the final camera position and state.

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    CinemachineVirtualCameraBase
    CinemachineFreeLook
    Inherited Members
    CinemachineVirtualCameraBase.m_ExcludedPropertiesInInspector
    CinemachineVirtualCameraBase.m_LockStageInInspector
    CinemachineVirtualCameraBase.ValidatingStreamVersion
    CinemachineVirtualCameraBase.m_Priority
    CinemachineVirtualCameraBase.m_StandbyUpdate
    CinemachineVirtualCameraBase.AddExtension(CinemachineExtension)
    CinemachineVirtualCameraBase.RemoveExtension(CinemachineExtension)
    CinemachineVirtualCameraBase.InvokePostPipelineStageCallback(CinemachineVirtualCameraBase, CinemachineCore.Stage, CameraState, Single)
    CinemachineVirtualCameraBase.InvokeOnTransitionInExtensions(ICinemachineCamera, Vector3, Single)
    CinemachineVirtualCameraBase.Name
    CinemachineVirtualCameraBase.Description
    CinemachineVirtualCameraBase.Priority
    CinemachineVirtualCameraBase.ApplyPositionBlendMethod(CameraState, CinemachineVirtualCameraBase.BlendHint)
    CinemachineVirtualCameraBase.VirtualCameraGameObject
    CinemachineVirtualCameraBase.IsValid
    CinemachineVirtualCameraBase.ParentCamera
    CinemachineVirtualCameraBase.UpdateCameraState(Vector3, Single)
    CinemachineVirtualCameraBase.OnTransformParentChanged()
    CinemachineVirtualCameraBase.Start()
    CinemachineVirtualCameraBase.OnDisable()
    CinemachineVirtualCameraBase.Update()
    CinemachineVirtualCameraBase.ResolveLookAt(Transform)
    CinemachineVirtualCameraBase.ResolveFollow(Transform)
    CinemachineVirtualCameraBase.MoveToTopOfPrioritySubqueue()
    CinemachineVirtualCameraBase.CreateBlend(ICinemachineCamera, ICinemachineCamera, CinemachineBlendDefinition, CinemachineBlend)
    CinemachineVirtualCameraBase.PullStateFromVirtualCamera(Vector3, LensSettings)
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(String, Single)
    MonoBehaviour.InvokeRepeating(String, Single, Single)
    MonoBehaviour.CancelInvoke(String)
    MonoBehaviour.IsInvoking(String)
    MonoBehaviour.StartCoroutine(String)
    MonoBehaviour.StartCoroutine(String, Object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(String)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(Object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, Component)
    Component.TryGetComponent<T>(T)
    Component.GetComponent(String)
    Component.GetComponentInChildren(Type, Boolean)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(Boolean)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, Boolean)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(Boolean)
    Component.GetComponentsInChildren<T>(Boolean, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, Boolean)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(Boolean)
    Component.GetComponentsInParent<T>(Boolean, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(String)
    Component.SendMessageUpwards(String, Object, SendMessageOptions)
    Component.SendMessageUpwards(String, Object)
    Component.SendMessageUpwards(String)
    Component.SendMessageUpwards(String, SendMessageOptions)
    Component.SendMessage(String, Object)
    Component.SendMessage(String)
    Component.SendMessage(String, Object, SendMessageOptions)
    Component.SendMessage(String, SendMessageOptions)
    Component.BroadcastMessage(String, Object, SendMessageOptions)
    Component.BroadcastMessage(String, Object)
    Component.BroadcastMessage(String)
    Component.BroadcastMessage(String, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Component.rigidbody
    Component.rigidbody2D
    Component.camera
    Component.light
    Component.animation
    Component.constantForce
    Component.renderer
    Component.audio
    Component.networkView
    Component.collider
    Component.collider2D
    Component.hingeJoint
    Component.particleSystem
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(Object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, Boolean)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, Boolean)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    UnityEngine.Object.FindObjectsOfType<T>(System.Boolean)
    Object.FindObjectOfType<T>()
    UnityEngine.Object.FindObjectOfType<T>(System.Boolean)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindObjectOfType(Type, Boolean)
    Object.ToString()
    Object.name
    Object.hideFlags
    Namespace: Cinemachine
    Syntax
    [DocumentationSorting(DocumentationSortingAttribute.Level.UserRef)]
    [DisallowMultipleComponent]
    [ExecuteInEditMode]
    [ExcludeFromPreset]
    [AddComponentMenu("Cinemachine/CinemachineFreeLook")]
    public class CinemachineFreeLook : CinemachineVirtualCameraBase, ICinemachineCamera

    Fields

    CreateRigOverride

    Override component pipeline creation. This needs to be done by the editor to support Undo. The override must do exactly the same thing as the CreatePipeline method in this class.

    Declaration
    public static CinemachineFreeLook.CreateRigDelegate CreateRigOverride
    Field Value
    Type Description
    CinemachineFreeLook.CreateRigDelegate

    DestroyRigOverride

    Override component pipeline destruction. This needs to be done by the editor to support Undo.

    Declaration
    public static CinemachineFreeLook.DestroyRigDelegate DestroyRigOverride
    Field Value
    Type Description
    CinemachineFreeLook.DestroyRigDelegate

    m_BindingMode

    The coordinate space to use when interpreting the offset from the target

    Declaration
    [Header("Orbits")]
    [Tooltip("The coordinate space to use when interpreting the offset from the target.  This is also used to set the camera's Up vector, which will be maintained when aiming the camera.")]
    public CinemachineTransposer.BindingMode m_BindingMode
    Field Value
    Type Description
    CinemachineTransposer.BindingMode

    m_CommonLens

    If enabled, this lens setting will apply to all three child rigs, otherwise the child rig lens settings will be used

    Declaration
    [Tooltip("If enabled, this lens setting will apply to all three child rigs, otherwise the child rig lens settings will be used")]
    [FormerlySerializedAs("m_UseCommonLensSetting")]
    public bool m_CommonLens
    Field Value
    Type Description
    Boolean

    m_Follow

    Object for the camera children wants to move with (the body target)

    Declaration
    [Tooltip("Object for the camera children wants to move with (the body target).")]
    public Transform m_Follow
    Field Value
    Type Description
    Transform

    m_Heading

    The definition of Forward. Camera will follow behind

    Declaration
    [Tooltip("The definition of Forward.  Camera will follow behind.")]
    public CinemachineOrbitalTransposer.Heading m_Heading
    Field Value
    Type Description
    CinemachineOrbitalTransposer.Heading

    m_Lens

    Specifies the lens properties of this Virtual Camera. This generally mirrors the Unity Camera's lens settings, and will be used to drive the Unity camera when the vcam is active

    Declaration
    [FormerlySerializedAs("m_LensAttributes")]
    [Tooltip("Specifies the lens properties of this Virtual Camera.  This generally mirrors the Unity Camera's lens settings, and will be used to drive the Unity camera when the vcam is active")]
    public LensSettings m_Lens
    Field Value
    Type Description
    LensSettings

    m_LookAt

    Object for the camera children to look at (the aim target)

    Declaration
    [Tooltip("Object for the camera children to look at (the aim target).")]
    public Transform m_LookAt
    Field Value
    Type Description
    Transform

    m_Orbits

    The radius and height of the three orbiting rigs

    Declaration
    [Tooltip("The radius and height of the three orbiting rigs.")]
    public CinemachineFreeLook.Orbit[] m_Orbits
    Field Value
    Type Description
    CinemachineFreeLook.Orbit[]

    m_RecenterToTargetHeading

    Controls how automatic recentering of the X axis is accomplished

    Declaration
    [Tooltip("Controls how automatic recentering of the X axis is accomplished")]
    public AxisState.Recentering m_RecenterToTargetHeading
    Field Value
    Type Description
    AxisState.Recentering

    m_SplineCurvature

    Declaration
    [Tooltip("Controls how taut is the line that connects the rigs' orbits, which determines final placement on the Y axis")]
    [Range(0F, 1F)]
    [FormerlySerializedAs("m_SplineTension")]
    public float m_SplineCurvature
    Field Value
    Type Description
    Single

    m_Transitions

    Collection of parameters that influence how this virtual camera transitions from other virtual cameras

    Declaration
    public CinemachineVirtualCameraBase.TransitionParams m_Transitions
    Field Value
    Type Description
    CinemachineVirtualCameraBase.TransitionParams

    m_XAxis

    The Horizontal axis. Value is -180...180. This is passed on to the rigs' OrbitalTransposer component

    Declaration
    [Tooltip("The Horizontal axis.  Value is -180...180.  This is passed on to the rigs' OrbitalTransposer component")]
    public AxisState m_XAxis
    Field Value
    Type Description
    AxisState

    m_YAxis

    The Vertical axis. Value is 0..1. Chooses how to blend the child rigs

    Declaration
    [Header("Axis Control")]
    [Tooltip("The Vertical axis.  Value is 0..1.  Chooses how to blend the child rigs")]
    public AxisState m_YAxis
    Field Value
    Type Description
    AxisState

    m_YAxisRecentering

    Controls how automatic recentering of the Y axis is accomplished

    Declaration
    [Tooltip("Controls how automatic recentering of the Y axis is accomplished")]
    public AxisState.Recentering m_YAxisRecentering
    Field Value
    Type Description
    AxisState.Recentering

    Properties

    Follow

    Get the current Follow target. Returns parent's Follow if parent is non-null and no specific Follow defined for this camera

    Declaration
    public override Transform Follow { get; set; }
    Property Value
    Type Description
    Transform
    Overrides
    CinemachineVirtualCameraBase.Follow

    LookAt

    Get the current LookAt target. Returns parent's LookAt if parent is non-null and no specific LookAt defined for this camera

    Declaration
    public override Transform LookAt { get; set; }
    Property Value
    Type Description
    Transform
    Overrides
    CinemachineVirtualCameraBase.LookAt

    PreviousStateIsValid

    Declaration
    public override bool PreviousStateIsValid { get; set; }
    Property Value
    Type Description
    Boolean
    Overrides
    CinemachineVirtualCameraBase.PreviousStateIsValid

    RigNames

    Names of the 3 child rigs

    Declaration
    public static string[] RigNames { get; }
    Property Value
    Type Description
    String[]

    State

    The cacmera state, which will be a blend of the child rig states

    Declaration
    public override CameraState State { get; }
    Property Value
    Type Description
    CameraState
    Overrides
    CinemachineVirtualCameraBase.State

    Methods

    GetLocalPositionForCameraFromInput(Single)

    Returns the local position of the camera along the spline used to connect the three camera rigs. Does not take into account the current heading of the camera (or its target)

    Declaration
    public Vector3 GetLocalPositionForCameraFromInput(float t)
    Parameters
    Type Name Description
    Single t

    The t-value for the camera on its spline. Internally clamped to the value [0,1]

    Returns
    Type Description
    Vector3

    The local offset (back + up) of the camera WRT its target based on the supplied t-value

    GetRig(Int32)

    Get a child rig

    Declaration
    public CinemachineVirtualCamera GetRig(int i)
    Parameters
    Type Name Description
    Int32 i

    Rig index. Can be 0, 1, or 2

    Returns
    Type Description
    CinemachineVirtualCamera

    The rig, or null if index is bad.

    InternalUpdateCameraState(Vector3, Single)

    Internal use only. Called by CinemachineCore at designated update time so the vcam can position itself and track its targets. All 3 child rigs are updated, and a blend calculated, depending on the value of the Y axis.

    Declaration
    public override void InternalUpdateCameraState(Vector3 worldUp, float deltaTime)
    Parameters
    Type Name Description
    Vector3 worldUp

    Default world Up, set by the CinemachineBrain

    Single deltaTime

    Delta time for time-based effects (ignore if less than 0)

    Overrides
    CinemachineVirtualCameraBase.InternalUpdateCameraState(Vector3, Single)

    IsLiveChild(ICinemachineCamera, Boolean)

    Check whether the vcam a live child of this camera. Returns true if the child is currently contributing actively to the camera state.

    Declaration
    public override bool IsLiveChild(ICinemachineCamera vcam, bool dominantChildOnly = false)
    Parameters
    Type Name Description
    ICinemachineCamera vcam

    The Virtual Camera to check

    Boolean dominantChildOnly

    If truw, will only return true if this vcam is the dominat live child

    Returns
    Type Description
    Boolean

    True if the vcam is currently actively influencing the state of this vcam

    Overrides
    CinemachineVirtualCameraBase.IsLiveChild(ICinemachineCamera, Boolean)

    OnDestroy()

    Makes sure that the child rigs get destroyed in an undo-firndly manner. Invalidates the rig cache.

    Declaration
    protected override void OnDestroy()
    Overrides
    CinemachineVirtualCameraBase.OnDestroy()

    OnEnable()

    Updates the child rig cache

    Declaration
    protected override void OnEnable()
    Overrides
    CinemachineVirtualCameraBase.OnEnable()

    OnTargetObjectWarped(Transform, Vector3)

    This is called to notify the vcam that a target got warped, so that the vcam can update its internal state to make the camera also warp seamlessy.

    Declaration
    public override void OnTargetObjectWarped(Transform target, Vector3 positionDelta)
    Parameters
    Type Name Description
    Transform target

    The object that was warped

    Vector3 positionDelta

    The amount the target's position changed

    Overrides
    CinemachineVirtualCameraBase.OnTargetObjectWarped(Transform, Vector3)

    OnTransitionFromCamera(ICinemachineCamera, Vector3, Single)

    If we are transitioning from another FreeLook, grab the axis values from it.

    Declaration
    public override void OnTransitionFromCamera(ICinemachineCamera fromCam, Vector3 worldUp, float deltaTime)
    Parameters
    Type Name Description
    ICinemachineCamera fromCam

    The camera being deactivated. May be null.

    Vector3 worldUp

    Default world Up, set by the CinemachineBrain

    Single deltaTime

    Delta time for time-based effects (ignore if less than or equal to 0)

    Overrides
    CinemachineVirtualCameraBase.OnTransitionFromCamera(ICinemachineCamera, Vector3, Single)

    OnValidate()

    Enforce bounds for fields, when changed in inspector.

    Declaration
    protected override void OnValidate()
    Overrides
    CinemachineVirtualCameraBase.OnValidate()
    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