docs.unity3d.com
    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, 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.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    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
    Namespace: UnityEngine.SpatialTracking
    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

    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

    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
    Boolean

    Methods

    Awake()

    Declaration
    protected virtual void Awake()

    FixedUpdate()

    Declaration
    protected virtual void FixedUpdate()

    OnBeforeRender()

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

    OnDestroy()

    Declaration
    protected virtual void OnDestroy()

    OnDisable()

    Declaration
    protected virtual void OnDisable()

    OnEnable()

    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(TrackedPoseDriver.DeviceType, TrackedPoseDriver.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
    Boolean

    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()

    Declaration
    protected virtual void Update()
    Back to top
    Terms of use
    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