Class XRHandSubsystem
A subsystem for detecting and tracking hands and their corresponding joint pose data.
Inheritance
Implements
Inherited Members
Namespace: UnityEngine.XR.Hands
Assembly: solution.dll
Syntax
public class XRHandSubsystem : SubsystemWithProvider<XRHandSubsystem, XRHandSubsystemDescriptor, XRHandSubsystemProvider>, ISubsystem
Remarks
The XRHandSubsystem
class is the main entry point for accessing hand tracking data
provided by an XR device. A provider implementation that reads tracking data from the
user's device and provides updates to this subsystem must also be available. The XR
Hands package includes a provider implementation for OpenXR.
Get an instance for this XRHandSubsystem
from the active XR
loader, as described in Get the XRHandSubsystem instance.
For lowest latency, read the tracking data available from the leftHand
and rightHand properties in a delegate function assigned to the
updatedHands callback. This callback is invoked twice per frame, once near
the MonoBehaviour.Update
event and once near the UnityEngine.Application.onBeforeRender
event. The BeforeRender update provides the lowest latency between
hand motion and rendering, but occurs too late to affect physics. In addition, trying to
perform too much work during the BeforeRender
callback can negatively impact framerate.
For best results, update game logic affected by hand tracking in a
Dynamic update and perform a final update of hand visuals in a
BeforeRender update.
Refer to Hand tracking data for more information.
Constructors
Name | Description |
---|---|
XRHandSubsystem() | Constructs a subsystem. Do not invoke directly. |
Fields
Name | Description |
---|---|
handsUpdated | Obsolete. Use updatedHands instead. |
preprocessJoints | This is called after the subsystem retrieves joint data from the provider, and before and IXRHandProcessors' ProcessJoints(XRHandSubsystem, UpdateSuccessFlags, UpdateType) are called. |
trackingAcquired | A callback invoked when the subsystem begins tracking a hand's root pose and joints. |
trackingLost | A callback invoked when the subsystem stops tracking a hand's root pose and joints. |
updatedHands | A callback invoked for each hand update. |
Properties
Name | Description |
---|---|
jointsInLayout | Indicates which joints in the XRHandJointID list are supported by the current hand data provider. |
leftHand | Gets the left XRHand that is being tracked by this subsystem. |
rightHand | Gets the right XRHand that is being tracked by this subsystem. |
updateSuccessFlags | Describes what data on either hand was updated during the most recent hand update. |
Methods
Name | Description |
---|---|
OnCreate() | Called by Unity before the subsystem is returned from a call to |
OnDestroy() | Called by Unity before the subsystem is fully destroyed during a call to |
RegisterProcessor<TProcessor>(TProcessor) | Registers a processor for hand joint data. |
TryUpdateHands(UpdateType) | Request an update from the hand data provider. Application developers consuming hand tracking data should not call this function. |
UnregisterProcessor<TProcessor>(TProcessor) | Unregisters a processor for hand joint data. |