docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class TrackedPoseDriver

    The TrackedPoseDriver component applies the current Pose value of a tracked device to the transform of the GameObject. TrackedPoseDriver can track multiple types of devices including XR HMDs, controllers, and remotes.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    TrackedPoseDriver
    Inherited Members
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(string, float)
    MonoBehaviour.InvokeRepeating(string, float, float)
    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, out Component)
    Component.TryGetComponent<T>(out T)
    Component.GetComponent(string)
    Component.GetComponentInChildren(Type, bool)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(bool)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, bool)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(bool)
    Component.GetComponentsInChildren<T>(bool, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, bool)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(bool)
    Component.GetComponentsInParent<T>(bool, 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
    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, bool)
    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, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectOfType<T>()
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.ToString()
    Object.name
    Object.hideFlags
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.SpatialTracking
    Assembly: UnityEngine.SpatialTracking.dll
    Syntax
    [DefaultExecutionOrder(-30000)]
    [Serializable]
    [AddComponentMenu("XR/Tracked Pose Driver")]
    [HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.legacyinputhelpers@2.1/manual/index.html")]
    public class TrackedPoseDriver : MonoBehaviour

    Fields

    m_OriginPose

    The origin pose is the offset applied to any tracking data. This is only used when in legacy compatibility mode.

    Declaration
    protected Pose m_OriginPose
    Field Value
    Type Description
    Pose

    Properties

    UseRelativeTransform

    This is used to indicate whether the TrackedPoseDriver will use the object's original transform as its basis.

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

    deviceType

    This is used to indicate which pose the TrackedPoseDriver is currently tracking.

    Declaration
    public TrackedPoseDriver.DeviceType deviceType { get; }
    Property Value
    Type Description
    TrackedPoseDriver.DeviceType

    originPose

    originPose is an offset applied to any tracking data read from this object. Setting this value should be reserved for dealing with edge-cases, such as achieving parity between room-scale (floor centered) and stationary (head centered) tracking - without having to alter the transform hierarchy. For user locomotion and gameplay purposes you are usually better off just moving the parent transform of this object.

    Declaration
    public Pose originPose { get; set; }
    Property Value
    Type Description
    Pose

    poseProviderComponent

    Optional: This field holds the reference to the BasePoseProvider instance that, if set, will be used to override the behavior of the TrackedPoseDriver. When this field is empty, the TrackedPoseDriver will operate as per usual, with pose data being retrieved from the device or pose settings of the TrackedPoseDriver. When this field is set, the pose data will be provided by the attached BasePoseProvider. The device or pose fields will be hidden as they are no longer used to control the parent GameObject Transform.

    Declaration
    public BasePoseProvider poseProviderComponent { get; set; }
    Property Value
    Type Description
    BasePoseProvider

    poseSource

    The pose being tracked by the tracked pose driver

    Declaration
    public TrackedPoseDriver.TrackedPose poseSource { get; }
    Property Value
    Type Description
    TrackedPoseDriver.TrackedPose

    trackingType

    The tracking type being used by the tracked pose driver

    Declaration
    public TrackedPoseDriver.TrackingType trackingType { get; set; }
    Property Value
    Type Description
    TrackedPoseDriver.TrackingType

    updateType

    The update type being used by the tracked pose driver

    Declaration
    public TrackedPoseDriver.UpdateType updateType { get; set; }
    Property Value
    Type Description
    TrackedPoseDriver.UpdateType

    Methods

    Awake()

    Refer to MonoBehaviour.

    Declaration
    protected virtual void Awake()

    FixedUpdate()

    Refer to MonoBehaviour.

    Declaration
    protected virtual void FixedUpdate()

    OnBeforeRender()

    Refer to Application.

    For the same reason as DefaultExecutionOrder, a callback order is specified to apply the pose to the Transform before default user scripts execute.

    Declaration
    [BeforeRenderOrder(-30000)]
    protected virtual void OnBeforeRender()

    OnDestroy()

    Refer to MonoBehaviour.

    Declaration
    protected virtual void OnDestroy()

    OnDisable()

    Refer to MonoBehaviour.

    Declaration
    protected virtual void OnDisable()

    OnEnable()

    Refer to MonoBehaviour.

    Declaration
    protected virtual void OnEnable()

    PerformUpdate()

    PerformUpdate queries the data from the selected pose source, and then calls SetLocalTransform(Vector3, Quaternion, PoseDataFlags) to apply the pose.

    Declaration
    protected virtual void PerformUpdate()

    SetLocalTransform(Vector3, Quaternion, PoseDataFlags)

    Sets the transform that is being driven by the TrackedPoseDriver. will only correct set the rotation or position depending on the PoseDataFlags

    Declaration
    protected virtual void SetLocalTransform(Vector3 newPosition, Quaternion newRotation, PoseDataFlags poseFlags)
    Parameters
    Type Name Description
    Vector3 newPosition

    The position to apply.

    Quaternion newRotation

    The rotation to apply.

    PoseDataFlags poseFlags

    The flags indiciating which of the position/rotation values are provided by the calling code.

    SetPoseSource(DeviceType, TrackedPose)

    This method is used to set the device / pose pair for the SpatialTracking.TrackedPoseDriver. setting an invalid combination of these values will return false.

    Declaration
    public bool SetPoseSource(TrackedPoseDriver.DeviceType deviceType, TrackedPoseDriver.TrackedPose pose)
    Parameters
    Type Name Description
    TrackedPoseDriver.DeviceType deviceType

    The device type that we wish to track

    TrackedPoseDriver.TrackedPose pose

    The pose source that we wish to track

    Returns
    Type Description
    bool

    true if the values provided are sensible, otherwise false

    TransformPoseByOriginIfNeeded(Pose)

    This is only used when running in legacy mode, and will fake the behavior of the old implicit camera tracking. This will transform by the origin pose if necessary.

    Declaration
    protected Pose TransformPoseByOriginIfNeeded(Pose pose)
    Parameters
    Type Name Description
    Pose pose

    Pose to transform by the origin if in relative transform mode.

    Returns
    Type Description
    Pose

    The pose, with the applied transform if in Relative Transform mode.

    Update()

    Refer to MonoBehaviour.

    Declaration
    protected virtual void Update()

    Did you find this page useful? Please give it a rating:

    Thanks for rating this page!

    Report a problem on this page

    What kind of problem would you like to report?

    • This page needs code samples
    • Code samples do not work
    • Information is missing
    • Information is incorrect
    • Information is unclear or confusing
    • There is a spelling/grammar error on this page
    • Something else

    Thanks for letting us know! This page has been marked for review based on your feedback.

    If you have time, you can provide more information to help us fix the problem faster.

    Provide more information

    You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:

    You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:

    You've told us there is information missing from this page. Please tell us more about what's missing:

    You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:

    You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:

    You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:

    You've told us this page has a problem. Please tell us more about what's wrong:

    Thank you for helping to make the Unity documentation better!

    Your feedback has been submitted as a ticket for our documentation team to review.

    We are not able to reply to every ticket submitted.

    In This Article
    • Fields
      • m_OriginPose
    • Properties
      • UseRelativeTransform
      • deviceType
      • originPose
      • poseProviderComponent
      • poseSource
      • trackingType
      • updateType
    • Methods
      • Awake()
      • FixedUpdate()
      • OnBeforeRender()
      • OnDestroy()
      • OnDisable()
      • OnEnable()
      • PerformUpdate()
      • SetLocalTransform(Vector3, Quaternion, PoseDataFlags)
      • SetPoseSource(DeviceType, TrackedPose)
      • TransformPoseByOriginIfNeeded(Pose)
      • Update()
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)