docs.unity3d.com
    Show / Hide Table of Contents

    Class XRHandSkeletonDriver

    Controls a hierarchy of Transforms driven by joints in an XRHand. This component subscribes to events from an XRHandTrackingEvents component to move and rotate the joints when the hand is updated.

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    XRHandSkeletonDriver
    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, Boolean)
    Component.GetComponentInParent(Type)
    UnityEngine.Component.GetComponentInParent<T>(System.Boolean)
    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.FindObjectsByType(Type, FindObjectsSortMode)
    Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    UnityEngine.Object.FindObjectsByType<T>(UnityEngine.FindObjectsSortMode)
    UnityEngine.Object.FindObjectsOfType<T>(System.Boolean)
    UnityEngine.Object.FindObjectsByType<T>(UnityEngine.FindObjectsInactive, UnityEngine.FindObjectsSortMode)
    Object.FindObjectOfType<T>()
    UnityEngine.Object.FindObjectOfType<T>(System.Boolean)
    UnityEngine.Object.FindFirstObjectByType<T>()
    UnityEngine.Object.FindAnyObjectByType<T>()
    UnityEngine.Object.FindFirstObjectByType<T>(UnityEngine.FindObjectsInactive)
    UnityEngine.Object.FindAnyObjectByType<T>(UnityEngine.FindObjectsInactive)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, Boolean)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    Object.ToString()
    Object.name
    Object.hideFlags
    Namespace: UnityEngine.XR.Hands
    Syntax
    [HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.hands@1.1/api/UnityEngine.XR.Hands.XRHandSkeletonDriver.html")]
    public class XRHandSkeletonDriver : MonoBehaviour, ISerializationCallbackReceiver

    Fields

    m_HasJointTransformMask

    An array of booleans tracking which joint indexes have a valid transform to drive. This is calculated once when the references change to avoid a null check every time the joint is updated.

    Declaration
    protected bool[] m_HasJointTransformMask
    Field Value
    Type Description
    Boolean[]

    m_HasRootTransform

    A boolean tracking whether the root transform is valid. This is calculated once when the root transform changes to avoid a null check every time the root is updated.

    Declaration
    protected bool m_HasRootTransform
    Field Value
    Type Description
    Boolean

    m_JointLocalPoses

    The array of joint local poses indexed by the XRHandJointID which is updated by the method UpdateJointLocalPoses(XRHandJointsUpdatedEventArgs) and then applied to the joint transforms by the method ApplyUpdatedTransformPoses().

    Declaration
    protected NativeArray<Pose> m_JointLocalPoses
    Field Value
    Type Description
    NativeArray<Pose>

    m_JointTransformReferences

    The list of joint to transform references

    Declaration
    [SerializeField]
    [Tooltip("List of XR Hand Joints with a reference to a transform to drive.")]
    protected List<JointToTransformReference> m_JointTransformReferences
    Field Value
    Type Description
    List<JointToTransformReference>

    m_JointTransforms

    The array of joint data indexed by the XRHandJointID which is accessible via ToIndex(XRHandJointID).

    Declaration
    protected Transform[] m_JointTransforms
    Field Value
    Type Description
    Transform[]

    Properties

    handTrackingEvents

    The XRHandTrackingEvents component that will be the source of hand tracking events for this driver.

    Declaration
    public XRHandTrackingEvents handTrackingEvents { get; set; }
    Property Value
    Type Description
    XRHandTrackingEvents

    jointTransformReferences

    The serialized list of XRHandJointID with a reference to a transform to drive. After this list is finished being assigned or modified, use the method InitializeFromSerializedReferences() to update the runtime mapping of transforms to drive.

    Declaration
    public List<JointToTransformReference> jointTransformReferences { get; set; }
    Property Value
    Type Description
    List<JointToTransformReference>

    rootTransform

    The Transform that will be driven by the hand's root position and rotation.

    Declaration
    public Transform rootTransform { get; set; }
    Property Value
    Type Description
    Transform

    Methods

    ApplyUpdatedTransformPoses()

    Applies the values in the m_JointLocalPoses array to the m_JointTransforms array.

    Declaration
    protected virtual void ApplyUpdatedTransformPoses()
    Remarks

    Override this method to change how the local hand joint poses affect the transforms, such as ignoring position, or converting to a different coordinate space.

    FindJointsFromRoot(List<String>)

    Finds the joint transform references from the root.

    Declaration
    public virtual void FindJointsFromRoot(List<string> missingJointNames)
    Parameters
    Type Name Description
    List<String> missingJointNames

    A list of strings to list the joints that were not found.

    Remarks

    Override this method to change how the joint transform references are found from the root and setup in the m_JointTransformReferences. This method is called from the default inspector editor UI when the Find Joints button is clicked.

    InitializeFromSerializedReferences()

    Converts the serialized list jointTransformReferences to a mapping of Transforms to drive. This method is called automatically via OnAfterDeserialize. It can be called manually after the list of Transform references is modified at runtime to apply the changes.

    Declaration
    public void InitializeFromSerializedReferences()

    OnDisable()

    See MonoBehaviour. MonoBehaviour OnDisable method that unsubscribes from hand tracking events and disposes the joint local poses array.

    Declaration
    protected virtual void OnDisable()

    OnEnable()

    See MonoBehaviour. MonoBehaviour OnEnable method that subscribes to hand tracking events and allocates the joint local poses array.

    Declaration
    protected virtual void OnEnable()

    OnJointsUpdated(XRHandJointsUpdatedEventArgs)

    Updates all the joints of the hand. This method calls UpdateJointLocalPoses(XRHandJointsUpdatedEventArgs) to calculate the local poses of the joints and then immediately calls ApplyUpdatedTransformPoses() to apply the changes to the joint Transforms.

    Declaration
    protected virtual void OnJointsUpdated(XRHandJointsUpdatedEventArgs args)
    Parameters
    Type Name Description
    XRHandJointsUpdatedEventArgs args

    The event arguments for the XRHand joints updated.

    Remarks

    Override this method to change either how or when the m_JointLocalPoses array is updated and applied to the transforms.

    OnRootPoseUpdated(Pose)

    Update the rootTransform's local position and rotation with the hand's root pose.

    Declaration
    protected virtual void OnRootPoseUpdated(Pose rootPose)
    Parameters
    Type Name Description
    Pose rootPose

    The root pose of the hand.

    Remarks

    Override this method to change how to the root pose is applied to the skeleton.

    Reset()

    See MonoBehaviour.

    Declaration
    protected virtual void Reset()

    UpdateJointLocalPoses(XRHandJointsUpdatedEventArgs)

    Calculates the local poses for all the joints in the hand using the standard parent hierarchy. Call this method to update the m_JointLocalPoses array with the latest joint data.

    Declaration
    protected void UpdateJointLocalPoses(XRHandJointsUpdatedEventArgs args)
    Parameters
    Type Name Description
    XRHandJointsUpdatedEventArgs args

    The event arguments for the XRHand joints updated.

    Explicit Interface Implementations

    ISerializationCallbackReceiver.OnAfterDeserialize()

    Declaration
    void ISerializationCallbackReceiver.OnAfterDeserialize()
    Implements
    ISerializationCallbackReceiver.OnAfterDeserialize()

    ISerializationCallbackReceiver.OnBeforeSerialize()

    Declaration
    void ISerializationCallbackReceiver.OnBeforeSerialize()
    Implements
    ISerializationCallbackReceiver.OnBeforeSerialize()
    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