XR Hand Tracking Subsystem
XR Hand Tracking Subsytem is instantiated by the OpenXR hand tracking feature.
It controls starting and stopping underlying fetching data loop, exposes hand data and throws hand tracking related events.
Static | Description |
---|
XRHandTrackingSubsystem GetSubsystemInManager() | Returns the first XR Hand Tracking Subsystem instance in the Subsystem Manager if it exists |
Non-Static | Description |
---|
HandTrackingStatus Status | Gets hand tracking status. It can be Idle , Running or Error |
void Start() | Starts the hand tracking subsystem |
void Stop() | Stops the hand tracking subsystem |
Hand LeftHand | Left hand data |
Hand RightHand | Right hand data |
Hand GetHand(XrHandedness handedness) | Gets hand data by handedness |
event Action<Hand> OnHandTracked | Raised if a hand has been tracked this frame |
event Action<Hand> OnHandUntracked | Raised if a hand has been untracked this frame |
event Action<UpdatePhase> OnHandsUpdated | Raised after both hands data have been updated. UpdatePhase can be Dynamic (before Update calls) or BeforeRender |
Hand Struct
Hand data is a struct filled by the hand tracking subsystem and its hand tracking providers.
Both hands data can be retrieved by calling LeftHand
and RightHand
on the subsystem reference.
See LeftHand
and RightHand
in XR Hand Tracking Subsystem above.
Non-Static | Description |
---|
XrHandedness Handedness | Hand handedness. It can be XR_HAND_LEFT or XR_HAND_RIGHT |
XrSpace Space | Space in which joint data are stored. It can be XR_HAND_LOCAL or XR_HAND_WORLD (in XR Origin) |
bool IsTracked | True if the hand is currently tracked |
XrHandGesture Gesture | Gesture detected by hand tracking back-end |
float GestureRatio | Detected gesture's ratio from 0f to 1f |
float FlipRatio | Hand flip ratio from -1f to 1f respectively weither the palm orientation is turned opposite to HMD position or toward |
float Scale | Hand scale from .5f to 1.6f |
Pose Root | Hand root pose (equivalent to the wrist center pose in XR Origin) |
Pose[] Joints | Hand joint poses |
Pose GetHandJoint(XrHandJoint joint) | Returns a particular joint pose |
XR Hand Tracking Manager
XR Hand Tracking Manager is the component which handles the hand tracking visualisation's part.
It is responsible for instancing hand prefabs by listening the hand tracking subsystem events.
Static | Description |
---|
GameObject DefaultLeftHandPrefab | Reference to the default Left Hand prefab in resources folder. Packages > Prefabs > Resources > QualcommHandLeft |
GameObject DefaultRightHandPrefab | Reference to the default Right Hand prefab in resources folder. Packages > Prefabs > Resources > QualcommHandRight |
XRHandTrackingManager InstantiateHandTrackingManager() | Instantiate a Hand Tracking Manager with Default Hand prefabs |
XRHandTrackingManager GetOrCreate(GameObject leftHandPrefab, GameObject rightHandPrefab) | Gets existing or creates a Hand Tracking Manager if it doesn't exist with Hand prefabs given in parameters |
void Destroy(XRHandTrackingManager manager) | Destroys a given Hand Tracking Manager instance or tries to find one to destroy if it does exist |
Non-Static | Description |
---|
GameObject LeftHandPrefab | Left prefab object that will be instantiated |
GameObject RightHandPrefab | Right prefab object that will be instantiated |
void RefreshLeftHand() | Regenerates the left hand object if the prefab has changed |
void RefreshRightHand() | Regenerates the right hand object if the prefab has changed |
void ToggleLeftHand(bool visible) | Toggles the left hand visibility |
void ToggleRightHand(bool visible) | Toggles the right hand visibility |
void SetLeftHandSkin(HandSkin skin) | Sets the left hand skin if the hand object is skinnable |
void SetRightHandSkin(HandSkin skin) | Sets the right hand skin if the hand object is skinnable |