Class HandTracking
This OpenXRInteractionFeature enables the use of hand-tracking data in OpenXR through the XRHandSubsystem. It enables XR_EXT_hand_tracking in the underlying runtime. To retrieve hand data, use the XRHandSubsystem retrieved from subsystem.
Namespace: UnityEngine.XR.Hands.OpenXR
Assembly: Unity.XR.Hands.dll
Syntax
public class HandTracking : OpenXRFeature
Remarks
For this extension to be available, you must install the XR Hands package.
Fields
destroyingSubsystem
Called just before this feature destroys an XRHandSubsystem.
Declaration
public static Action<HandTracking.DestroyingSubsystemEventArgs> destroyingSubsystem
Field Value
Type | Description |
---|---|
Action<HandTracking.DestroyingSubsystemEventArgs> |
extensionString
The OpenXR Extension string. OpenXR uses this to check if this extension is available or enabled. See hand interaction extension documentation for more information on this OpenXR extension.
Declaration
public const string extensionString = "XR_EXT_hand_tracking"
Field Value
Type | Description |
---|---|
string |
featureId
The feature ID string. This is used to give the feature a well known ID for reference.
Declaration
public const string featureId = "com.unity.openxr.feature.input.handtracking"
Field Value
Type | Description |
---|---|
string |
subsystemCreated
Called when this feature creates an XRHandSubsystem.
Declaration
public static Action<HandTracking.SubsystemCreatedEventArgs> subsystemCreated
Field Value
Type | Description |
---|---|
Action<HandTracking.SubsystemCreatedEventArgs> |
Properties
automaticallyInitializeSubsystem
Whether an XRHandSubsystem should be created when the session is. Defaults to true.
Declaration
public static bool automaticallyInitializeSubsystem { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
If you wish to set this to false in time to stop
automatic creation, do so in a static
method decorated with
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
.
When you wish to initialize the subsystem, you can then call
EnsureSubsystemInitialized().
subsystem
The XRHandSubsystem that retrieves hand data from its provider. Will only be valid when this feature is enabled and running. To subscribe to updates, use handsUpdated.
Declaration
public static XRHandSubsystem subsystem { get; }
Property Value
Type | Description |
---|---|
XRHandSubsystem |
Methods
EnsureSubsystemInitialized()
Ensures an XRHandSubsystem is created.
Declaration
public static void EnsureSubsystemInitialized()
Remarks
Will be automatically called at start-up if automaticallyInitializeSubsystem is true, which it is by default. If called later, will automatically start the subsystem if the session is running.
GetValidationChecks(List<ValidationRule>, BuildTargetGroup)
Declaration
protected override void GetValidationChecks(List<ValidationRule> results, BuildTargetGroup targetGroup)
Parameters
Type | Name | Description |
---|---|---|
List<ValidationRule> | results | |
BuildTargetGroup | targetGroup |
HookGetInstanceProcAddr(IntPtr)
Declaration
protected override IntPtr HookGetInstanceProcAddr(IntPtr func)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | func |
Returns
Type | Description |
---|---|
IntPtr |
OnAppSpaceChange(ulong)
See OpenXRFeature.OnAppSpaceChange(ulong).
Declaration
protected override void OnAppSpaceChange(ulong xrSpace)
Parameters
Type | Name | Description |
---|---|---|
ulong | xrSpace |
OnInstanceCreate(ulong)
See OpenXRFeature.OnInstanceCreate(ulong).
Declaration
protected override bool OnInstanceCreate(ulong xrInstance)
Parameters
Type | Name | Description |
---|---|---|
ulong | xrInstance |
Returns
Type | Description |
---|---|
bool |
OnInstanceDestroy(ulong)
See OpenXRFeature.OnInstanceDestroy(ulong).
Declaration
protected override void OnInstanceDestroy(ulong xrInstance)
Parameters
Type | Name | Description |
---|---|---|
ulong | xrInstance |
OnInstanceLossPending(ulong)
See OpenXRFeature.OnInstanceLossPending(ulong).
Declaration
protected override void OnInstanceLossPending(ulong xrInstance)
Parameters
Type | Name | Description |
---|---|---|
ulong | xrInstance |
OnSessionCreate(ulong)
Called after xrCreateSession.
Declaration
protected override void OnSessionCreate(ulong xrSession)
Parameters
Type | Name | Description |
---|---|---|
ulong | xrSession |
Remarks
Creates an XRHandSubsystem with the OpenXR provider.
OnSessionDestroy(ulong)
See OpenXRFeature.OnAppSpaceChange(ulong).
Declaration
protected override void OnSessionDestroy(ulong xrSpace)
Parameters
Type | Name | Description |
---|---|---|
ulong | xrSpace |
OnSubsystemDestroy()
Called before the OpenXR loader destroys its subsystems.
Declaration
protected override void OnSubsystemDestroy()
Remarks
Destroys the XRHandSubsystem.
OnSubsystemStart()
Called after the OpenXR loader has started its subsystems.
Declaration
protected override void OnSubsystemStart()
Remarks
Starts the XRHandSubsystem and automatic updating for it. To subscribe to updates, use handsUpdated.
OnSubsystemStop()
Called before the OpenXR loader stops its subsystems.
Declaration
protected override void OnSubsystemStop()
Remarks
Stops the XRHandSubsystem and automatic updating for it.
OnSystemChange(ulong)
See OpenXRFeature.OnSystemChange(ulong).
Declaration
protected override void OnSystemChange(ulong xrSystem)
Parameters
Type | Name | Description |
---|---|---|
ulong | xrSystem |