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

    Class CinemachineTransposer

    This is a CinemachineComponent in the Body section of the component pipeline. Its job is to position the camera in a fixed relationship to the vcam's Follow target object, with offsets and damping.

    The Tansposer will only change the camera's position in space. It will not re-orient or otherwise aim the camera. To to that, you need to instruct the vcam in the Aim section of its pipeline.

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    CinemachineComponentBase
    CinemachineTransposer
    CinemachineOrbitalTransposer
    Inherited Members
    CinemachineComponentBase.Epsilon
    CinemachineComponentBase.VirtualCamera
    CinemachineComponentBase.FollowTarget
    CinemachineComponentBase.LookAtTarget
    CinemachineComponentBase.AbstractFollowTargetGroup
    CinemachineComponentBase.FollowTargetGroup
    CinemachineComponentBase.FollowTargetPosition
    CinemachineComponentBase.FollowTargetRotation
    CinemachineComponentBase.AbstractLookAtTargetGroup
    CinemachineComponentBase.LookAtTargetGroup
    CinemachineComponentBase.LookAtTargetPosition
    CinemachineComponentBase.LookAtTargetRotation
    CinemachineComponentBase.VcamState
    CinemachineComponentBase.PrePipelineMutateCameraState(CameraState, Single)
    CinemachineComponentBase.OnTransitionFromCamera(ICinemachineCamera, Vector3, Single, CinemachineVirtualCameraBase.TransitionParams)
    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)]
    [AddComponentMenu("")]
    public class CinemachineTransposer : CinemachineComponentBase

    Fields

    m_AngularDamping

    How aggressively the camera tries to track the target's orientation. Small numbers are more responsive. Larger numbers give a more heavy slowly responding camera.

    Declaration
    [Range(0F, 20F)]
    [Tooltip("How aggressively the camera tries to track the target's orientation.  Small numbers are more responsive.  Larger numbers give a more heavy slowly responding camera.")]
    public float m_AngularDamping
    Field Value
    Type Description
    Single

    m_AngularDampingMode

    How to calculate the angular damping for the target orientation. Use Quaternion if you expect the target to take on very steep pitches, which would be subject to gimbal lock if Eulers are used.

    Declaration
    public CinemachineTransposer.AngularDampingMode m_AngularDampingMode
    Field Value
    Type Description
    CinemachineTransposer.AngularDampingMode

    m_BindingMode

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

    Declaration
    [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_FollowOffset

    The distance which the transposer will attempt to maintain from the transposer subject

    Declaration
    [Tooltip("The distance vector that the transposer will attempt to maintain from the Follow target")]
    public Vector3 m_FollowOffset
    Field Value
    Type Description
    Vector3

    m_PitchDamping

    How aggressively the camera tries to track the target rotation's X angle. Small numbers are more responsive. Larger numbers give a more heavy slowly responding camera.

    Declaration
    [Range(0F, 20F)]
    [Tooltip("How aggressively the camera tries to track the target rotation's X angle.  Small numbers are more responsive.  Larger numbers give a more heavy slowly responding camera.")]
    public float m_PitchDamping
    Field Value
    Type Description
    Single

    m_RollDamping

    How aggressively the camera tries to track the target rotation's Z angle. Small numbers are more responsive. Larger numbers give a more heavy slowly responding camera.

    Declaration
    [Range(0F, 20F)]
    [Tooltip("How aggressively the camera tries to track the target rotation's Z angle.  Small numbers are more responsive.  Larger numbers give a more heavy slowly responding camera.")]
    public float m_RollDamping
    Field Value
    Type Description
    Single

    m_XDamping

    How aggressively the camera tries to maintain the offset in the X-axis. Small numbers are more responsive, rapidly translating the camera to keep the target's x-axis offset. Larger numbers give a more heavy slowly responding camera. Using different settings per axis can yield a wide range of camera behaviors

    Declaration
    [Range(0F, 20F)]
    [Tooltip("How aggressively the camera tries to maintain the offset in the X-axis.  Small numbers are more responsive, rapidly translating the camera to keep the target's x-axis offset.  Larger numbers give a more heavy slowly responding camera. Using different settings per axis can yield a wide range of camera behaviors.")]
    public float m_XDamping
    Field Value
    Type Description
    Single

    m_YawDamping

    How aggressively the camera tries to track the target rotation's Y angle. Small numbers are more responsive. Larger numbers give a more heavy slowly responding camera.

    Declaration
    [Range(0F, 20F)]
    [Tooltip("How aggressively the camera tries to track the target rotation's Y angle.  Small numbers are more responsive.  Larger numbers give a more heavy slowly responding camera.")]
    public float m_YawDamping
    Field Value
    Type Description
    Single

    m_YDamping

    How aggressively the camera tries to maintain the offset in the Y-axis. Small numbers are more responsive, rapidly translating the camera to keep the target's y-axis offset. Larger numbers give a more heavy slowly responding camera. Using different settings per axis can yield a wide range of camera behaviors

    Declaration
    [Range(0F, 20F)]
    [Tooltip("How aggressively the camera tries to maintain the offset in the Y-axis.  Small numbers are more responsive, rapidly translating the camera to keep the target's y-axis offset.  Larger numbers give a more heavy slowly responding camera. Using different settings per axis can yield a wide range of camera behaviors.")]
    public float m_YDamping
    Field Value
    Type Description
    Single

    m_ZDamping

    How aggressively the camera tries to maintain the offset in the Z-axis. Small numbers are more responsive, rapidly translating the camera to keep the target's z-axis offset. Larger numbers give a more heavy slowly responding camera. Using different settings per axis can yield a wide range of camera behaviors

    Declaration
    [Range(0F, 20F)]
    [Tooltip("How aggressively the camera tries to maintain the offset in the Z-axis.  Small numbers are more responsive, rapidly translating the camera to keep the target's z-axis offset.  Larger numbers give a more heavy slowly responding camera. Using different settings per axis can yield a wide range of camera behaviors.")]
    public float m_ZDamping
    Field Value
    Type Description
    Single

    Properties

    AngularDamping

    Damping speeds for each of the 3 axes of the target's rotation

    Declaration
    protected Vector3 AngularDamping { get; }
    Property Value
    Type Description
    Vector3

    Damping

    Damping speeds for each of the 3 axes of the offset from target

    Declaration
    protected Vector3 Damping { get; }
    Property Value
    Type Description
    Vector3

    EffectiveOffset

    Get the target offset, with sanitization

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

    HideOffsetInInspector

    Hide the offset in int inspector. Used by FreeLook.

    Declaration
    public bool HideOffsetInInspector { get; set; }
    Property Value
    Type Description
    Boolean

    IsValid

    True if component is enabled and has a valid Follow target

    Declaration
    public override bool IsValid { get; }
    Property Value
    Type Description
    Boolean
    Overrides
    CinemachineComponentBase.IsValid

    Stage

    Get the Cinemachine Pipeline stage that this component implements. Always returns the Body stage

    Declaration
    public override CinemachineCore.Stage Stage { get; }
    Property Value
    Type Description
    CinemachineCore.Stage
    Overrides
    CinemachineComponentBase.Stage

    Methods

    GetReferenceOrientation(Vector3)

    Internal API for the Inspector Editor, so it can draw a marker at the target

    Declaration
    public Quaternion GetReferenceOrientation(Vector3 worldUp)
    Parameters
    Type Name Description
    Vector3 worldUp
    Returns
    Type Description
    Quaternion

    GetTargetCameraPosition(Vector3)

    Internal API for the Inspector Editor, so it can draw a marker at the target

    Declaration
    public virtual Vector3 GetTargetCameraPosition(Vector3 worldUp)
    Parameters
    Type Name Description
    Vector3 worldUp
    Returns
    Type Description
    Vector3

    InitPrevFrameStateInfo(ref CameraState, Single)

    Initializes the state for previous frame if appropriate.

    Declaration
    protected void InitPrevFrameStateInfo(ref CameraState curState, float deltaTime)
    Parameters
    Type Name Description
    CameraState curState
    Single deltaTime

    MutateCameraState(ref CameraState, Single)

    Positions the virtual camera according to the transposer rules.

    Declaration
    public override void MutateCameraState(ref CameraState curState, float deltaTime)
    Parameters
    Type Name Description
    CameraState curState

    The current camera state

    Single deltaTime

    Used for damping. If less than 0, no damping is done.

    Overrides
    CinemachineComponentBase.MutateCameraState(ref CameraState, Single)

    OnTargetObjectWarped(Transform, Vector3)

    This is called to notify the us that a target got warped, so that we 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
    CinemachineComponentBase.OnTargetObjectWarped(Transform, Vector3)

    OnValidate()

    Derived classes should call this from their OnValidate() implementation

    Declaration
    protected virtual void OnValidate()

    TrackTarget(Single, Vector3, Vector3, out Vector3, out Quaternion)

    Positions the virtual camera according to the transposer rules.

    Declaration
    protected void TrackTarget(float deltaTime, Vector3 up, Vector3 desiredCameraOffset, out Vector3 outTargetPosition, out Quaternion outTargetOrient)
    Parameters
    Type Name Description
    Single deltaTime

    Used for damping. If less than 0, no damping is done.

    Vector3 up

    Current camera up

    Vector3 desiredCameraOffset

    Where we want to put the camera relative to the follow target

    Vector3 outTargetPosition

    Resulting camera position

    Quaternion outTargetOrient

    Damped target orientation

    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