Class XRHandSubsystemProvider
Methods to implement by the implementing provider for an XRHandSubsystem.
Inherited Members
Namespace: UnityEngine.XR.Hands.ProviderImplementation
Assembly: Unity.XR.Hands.dll
Syntax
public abstract class XRHandSubsystemProvider : SubsystemProvider<XRHandSubsystem>
Properties
canSurfaceCommonPoseData
Whether the provider is currently able to surface data from any of TryGetAimPose(Handedness, out Pose), TryGetAimActivateValue(Handedness, out float), TryGetGraspValue(Handedness, out float), TryGetGripPose(Handedness, out Pose), TryGetPinchPose(Handedness, out Pose), TryGetPinchValue(Handedness, out float), or TryGetPinchPose(Handedness, out Pose).
Declaration
public virtual bool canSurfaceCommonPoseData { get; }
Property Value
| Type | Description |
|---|---|
| bool |
detectedHandMeshLayout
Describes which version of authored hand meshes is detected for use.
Declaration
public virtual XRDetectedHandMeshLayout detectedHandMeshLayout { get; }
Property Value
| Type | Description |
|---|---|
| XRDetectedHandMeshLayout |
Methods
AllowJointProcessing()
Method that determines whether joint processing is allowed for this provider.
Declaration
protected virtual bool AllowJointProcessing()
Returns
| Type | Description |
|---|---|
| bool | true if the XRHandSubsystem should allow IXRHandProcessor to process joints. |
GetFingerShapeConfiguration(XRHandFingerID)
Gets the XRFingerShapeConfiguration on the current device for the given XRHandFingerID.
Declaration
public virtual XRFingerShapeConfiguration GetFingerShapeConfiguration(XRHandFingerID fingerID)
Parameters
| Type | Name | Description |
|---|---|---|
| XRHandFingerID | fingerID | Which finger to get the XRFingerShapeConfiguration for. |
Returns
| Type | Description |
|---|---|
| XRFingerShapeConfiguration | A populated XRFingerShapeConfiguration representing range of motion for the given XRHandFingerID. |
Remarks
Called once for each finger on creation so that the subsystem will always have valid configurations to base detection math off of. If the provider does not override this, defaults will be reported - this means that if the device is more constrained in reporting joint data than the defaults, gestures and poses may not be detected correctly. Called after GetHandLayout(NativeArray<bool>) for each finger, but before the subsystem is returned during a call to XRHandSubsystemDescriptor.Create.
GetHandLayout(NativeArray<bool>)
Gets the layout of hand joints for this provider, by having the
provider mark each index corresponding to a XRHandJointID
get marked as true if the provider attempts to track
that joint.
Declaration
public abstract void GetHandLayout(NativeArray<bool> handJointsInLayout)
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<bool> | handJointsInLayout | Each index corresponds to a XRHandJointID. For each
joint that the provider will attempt to track, mark that spot as
|
Remarks
Called once on creation so that before the subsystem is even started, the user can immediately create a valid hierarchical structure as soon as they get a reference to the subsystem without even needing to start it. This is called before any call to GetFingerShapeConfiguration(XRHandFingerID).
TryGetAimActivateValue(Handedness, out float)
Gets the aim activate value. Will only be called if supportsAimActivateValue is enabled.
Declaration
public virtual bool TryGetAimActivateValue(Handedness handedness, out float aimActivateValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Handedness | handedness | Which hand to retrieve data for. |
| float | aimActivateValue | The aim activate value, if available. Will not be used if
|
Returns
| Type | Description |
|---|---|
| bool | Returns |
TryGetAimActivatedState(Handedness, out bool)
Gets whether the aim is fully activated. Will only be called if supportsAimActivateValue is enabled.
Declaration
public virtual bool TryGetAimActivatedState(Handedness handedness, out bool isAimActivated)
Parameters
| Type | Name | Description |
|---|---|---|
| Handedness | handedness | Which hand to retrieve data for. |
| bool | isAimActivated | Will be set to |
Returns
| Type | Description |
|---|---|
| bool | Returns |
Remarks
Data to evaluate the gesture might not be available when you call this function. When data is available,
the function returns true and sets isAimActivated to indicate
whether the aim gesture is fully activated. If this function returns false,
isAimActivated will be false whether or not the aim gesture is activated.
TryGetAimPose(Handedness, out Pose)
Gets the aim pose. Will only be called if supportsAimPose is enabled.
Declaration
public virtual bool TryGetAimPose(Handedness handedness, out Pose aimPose)
Parameters
| Type | Name | Description |
|---|---|---|
| Handedness | handedness | Which hand to retrieve data for. |
| Pose | aimPose | The pose to update the aim pose to, if available. Will not be used if
|
Returns
| Type | Description |
|---|---|
| bool | Returns |
TryGetAimState(Handedness, out XRHandAimState)
Attempts to get aim state for the given Handedness.
Declaration
public virtual bool TryGetAimState(Handedness handedness, out XRHandAimState aimState)
Parameters
| Type | Name | Description |
|---|---|---|
| Handedness | handedness | Denotes the hand you wish to obtain aim state for. |
| XRHandAimState | aimState | If |
Returns
| Type | Description |
|---|---|
| bool | Returns true if |
TryGetGraspFirmState(Handedness, out bool)
Gets whether the user is making a fist. Will only be called if supportsGraspValue is enabled.
Declaration
public virtual bool TryGetGraspFirmState(Handedness handedness, out bool isGraspFirm)
Parameters
| Type | Name | Description |
|---|---|---|
| Handedness | handedness | Which hand to retrieve data for. |
| bool | isGraspFirm | Will be set to |
Returns
| Type | Description |
|---|---|
| bool | Returns |
Remarks
Data to evaluate the gesture might not be available when you call this function. When data is available,
the function returns true and sets isGraspFirm to indicate
whether the user is making a fist (firm grasp). If this function returns false,
isGraspFirm will also be false (whether or not the user is making a fist).
TryGetGraspValue(Handedness, out float)
Gets the grasp value. Will only be called if supportsGraspValue is enabled.
Declaration
public virtual bool TryGetGraspValue(Handedness handedness, out float graspValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Handedness | handedness | Which hand to retrieve data for. |
| float | graspValue | The grasp value, if available. Will not be used if
|
Returns
| Type | Description |
|---|---|
| bool | Returns |
TryGetGripPose(Handedness, out Pose)
Gets the grip pose. Will only be called if supportsGripPose is enabled.
Declaration
public virtual bool TryGetGripPose(Handedness handedness, out Pose gripPose)
Parameters
| Type | Name | Description |
|---|---|---|
| Handedness | handedness | Which hand to retrieve data for. |
| Pose | gripPose | The pose to update the aim pose to, if available. Will not be used if
|
Returns
| Type | Description |
|---|---|
| bool | Returns |
TryGetMeshData(ref XRHandMeshDataQueryResult, ref XRHandMeshDataQueryParams)
Attempt to retrieve hand mesh data from the platform. Only called when TryGetMeshData(out XRHandMeshDataQueryResult, ref XRHandMeshDataQueryParams) is called.
Declaration
public virtual bool TryGetMeshData(ref XRHandMeshDataQueryResult result, ref XRHandMeshDataQueryParams queryParams)
Parameters
| Type | Name | Description |
|---|---|---|
| XRHandMeshDataQueryResult | result | Output data for hand meshes. |
| XRHandMeshDataQueryParams | queryParams | Input data for hand meshes. |
Returns
| Type | Description |
|---|---|
| bool | Returns |
TryGetPinchPose(Handedness, out Pose)
Gets the pinch pose. Will only be called if supportsPinchPose is enabled.
Declaration
public virtual bool TryGetPinchPose(Handedness handedness, out Pose pinchPose)
Parameters
| Type | Name | Description |
|---|---|---|
| Handedness | handedness | Which hand to retrieve data for. |
| Pose | pinchPose | The pose to update the pinch pose to, if available. Will not be used if
|
Returns
| Type | Description |
|---|---|
| bool | Returns |
TryGetPinchTouchedState(Handedness, out bool)
Gets whether the hand is performing a pinch gesture. Will only be called if supportsPinchValue is enabled.
Declaration
public virtual bool TryGetPinchTouchedState(Handedness handedness, out bool isPinched)
Parameters
| Type | Name | Description |
|---|---|---|
| Handedness | handedness | Which hand to retrieve data for. |
| bool | isPinched | Will be set to |
Returns
| Type | Description |
|---|---|
| bool | Returns |
Remarks
Data to evaluate the gesture might not be available when you call this function. When data is available,
the function returns true and sets isPinched to indicate
whether the hand is currently pinching. If this function returns false,
isPinched will be false whether or not the hand is pinching.
TryGetPinchValue(Handedness, out float)
Gets the pinch value. Will only be called if supportsPinchValue is enabled.
Declaration
public virtual bool TryGetPinchValue(Handedness handedness, out float pinchValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Handedness | handedness | Which hand to retrieve data for. |
| float | pinchValue | The pinch value, if available. Will not be used if
|
Returns
| Type | Description |
|---|---|
| bool | Returns |
TryGetPokePose(Handedness, out Pose)
Gets the poke pose. Will only be called if supportsPokePose is enabled.
Declaration
public virtual bool TryGetPokePose(Handedness handedness, out Pose pokePose)
Parameters
| Type | Name | Description |
|---|---|---|
| Handedness | handedness | Which hand to retrieve data for. |
| Pose | pokePose | The pose to update the poke pose to, if available. Will not be used if
|
Returns
| Type | Description |
|---|---|
| bool | Returns |
TryUpdateHands(UpdateType, ref Pose, NativeArray<XRHandJoint>, ref Pose, NativeArray<XRHandJoint>)
Attempts to retrieve current hand-tracking data from the provider.
Declaration
public abstract XRHandSubsystem.UpdateSuccessFlags TryUpdateHands(XRHandSubsystem.UpdateType updateType, ref Pose leftHandRootPose, NativeArray<XRHandJoint> leftHandJoints, ref Pose rightHandRootPose, NativeArray<XRHandJoint> rightHandJoints)
Parameters
| Type | Name | Description |
|---|---|---|
| XRHandSubsystem.UpdateType | updateType | Informs the provider which kind of timing the update is being requested under. |
| Pose | leftHandRootPose | Update this and include |
| NativeArray<XRHandJoint> | leftHandJoints | Array of hand joints to fill out for the left hand. These are
initialized with a copy of the current joint data for the left hand,
so if the last known tracking data for a particular joint is still
fine, you don't need to fill out that data again. If you update
these, include |
| Pose | rightHandRootPose | Update this and include |
| NativeArray<XRHandJoint> | rightHandJoints | Array of hand joints to fill out for the right hand. These are
initialized with a copy of the current joint data for the right hand,
so if the last known tracking data for a particular joint is still
fine, you don't need to fill out that data again. If you update
these, include |
Returns
| Type | Description |
|---|---|
| XRHandSubsystem.UpdateSuccessFlags | Returns XRHandSubsystem.UpdateSuccessFlags to describe which tracking data was successfully updated. |