Class XRHandSkeletonDriver
Controls a hierarchy of Transforms driven by joints in an XRHand.
This component subscribes to events from an XRHand
Implements
Inherited Members
Namespace: UnityEngine .XR.Hands
Assembly: Unity.XR.Hands.dll
Syntax
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.hands@1.4/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 |
---|---|
bool[] |
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 |
---|---|
bool |
m_JointLocalPoses
The array of joint local poses indexed by the XRHand
Declaration
protected NativeArray<Pose> m_JointLocalPoses
Field Value
Type | Description |
---|---|
Native |
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<Joint |
m_JointTransforms
The array of joint data indexed by the XRHand
Declaration
protected Transform[] m_JointTransforms
Field Value
Type | Description |
---|---|
Transform[] |
Properties
handTrackingEvents
The XRHand
Declaration
public XRHandTrackingEvents handTrackingEvents { get; set; }
Property Value
Type | Description |
---|---|
XRHand |
hasRootOffset
Bool tracking whether the root requires an offset to be applied to it.
Declaration
protected virtual bool hasRootOffset { get; }
Property Value
Type | Description |
---|---|
bool |
jointTransformReferences
The serialized list of XRHand
Declaration
public List<JointToTransformReference> jointTransformReferences { get; set; }
Property Value
Type | Description |
---|---|
List<Joint |
rootOffset
Offset translation applied to hand root position.
Declaration
protected virtual Vector3 rootOffset { get; }
Property Value
Type | Description |
---|---|
Vector3 |
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
ApplyRootPoseOffset(Vector3)
Applies an offset to the root pose of the hand skeleton. This can be used to adjust the position of the hand in situations where you want the hand visual to stop moving when interacting with an object. The offset is applied in the local space of the hand's root transform.
Declaration
public void ApplyRootPoseOffset(Vector3 rootPoseOffset)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | rootPoseOffset | A Vector3 representing the offset to apply to the root pose of the hand skeleton. |
ApplyUpdatedTransformPoses()
Applies the values in the m_Joint
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_Joint
InitializeFromSerializedReferences()
Converts the serialized list joint
Declaration
public void InitializeFromSerializedReferences()
OnDisable()
See Mono
Declaration
protected virtual void OnDisable()
OnEnable()
See Mono
Declaration
protected virtual void OnEnable()
OnJointsUpdated(XRHandJointsUpdatedEventArgs)
Updates all the joints of the hand. This method calls Update
Declaration
protected virtual void OnJointsUpdated(XRHandJointsUpdatedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
XRHand |
args | The event arguments for the XRHand joints updated. |
Remarks
Override this method to change either how or when the m_Joint
OnRootPoseUpdated(Pose)
Update the root
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 Mono
Declaration
protected virtual void Reset()
ResetRootPoseOffset()
Resets the offset of the root pose of the hand skeleton back to zero. This can be used to remove any previously applied offset, restoring the hand's root pose to its original position.
Declaration
public void ResetRootPoseOffset()
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_Joint
Declaration
protected void UpdateJointLocalPoses(XRHandJointsUpdatedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
XRHand |
args | The event arguments for the XRHand joints updated. |