Class VisionOSHandExtensions
Defines extension methods for platform-specific hand data.
Inherited Members
Namespace: UnityEngine.XR.VisionOS
Assembly: Unity.XR.VisionOS.dll
Syntax
public static class VisionOSHandExtensions
Fields
NumVisionOSJoints
The number of extra joints on visionOS
Declaration
public const int NumVisionOSJoints = 2
Field Value
| Type | Description |
|---|---|
| int |
Methods
FromIndex(int)
Call this to get the corresponding VisionOSHandJointID from an index into an array of associated data.
Declaration
public static VisionOSHandJointID FromIndex(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | Index to convert to an ID. |
Returns
| Type | Description |
|---|---|
| VisionOSHandJointID | The ID matching the index passed in. |
GetVisionOSJoint(XRHand, VisionOSHandJointID)
Retrieves a visionOS-specific hand joint by its ID.
Declaration
public static XRHandJoint GetVisionOSJoint(this XRHand hand, VisionOSHandJointID jointID)
Parameters
| Type | Name | Description |
|---|---|---|
| XRHand | hand | The hand this extension method extends. To call this extension
method, write it like
|
| VisionOSHandJointID | jointID | ID of the required joint. |
Returns
| Type | Description |
|---|---|
| XRHandJoint | The |
SetVisionOSJoint(Handedness, XRHandJoint)
Set joint data on the specified hand
Declaration
public static void SetVisionOSJoint(Handedness handedness, XRHandJoint joint)
Parameters
| Type | Name | Description |
|---|---|---|
| Handedness | handedness | The hand this joint belongs to |
| XRHandJoint | joint | The data for this joint. The ID of the joint must be in the range of VisionOSHandJointID values or this will throw. |
SetVisionOSRotation(Handedness, XRHandJoint, Quaternion?)
Set visionOS specific rotation per joint.
Declaration
public static void SetVisionOSRotation(Handedness handedness, XRHandJoint joint, Quaternion? rotation)
Parameters
| Type | Name | Description |
|---|---|---|
| Handedness | handedness | The hand this joint belongs to |
| XRHandJoint | joint | The data for this joint. The ID of the joint must be in the range of VisionOSHandJointID values or this will throw. |
| Quaternion? | rotation | The Apple-defined rotation for the given joint, but still converted to Unity space. |
SetVisionOSTrackingState(Handedness, XRHandJoint, bool?)
Set visionOS specific tracking state per joint.
Declaration
public static void SetVisionOSTrackingState(Handedness handedness, XRHandJoint joint, bool? trackingState)
Parameters
| Type | Name | Description |
|---|---|---|
| Handedness | handedness | The hand this joint belongs to |
| XRHandJoint | joint | The data for this joint. The ID of the joint must be in the range of VisionOSHandJointID values or this will throw. |
| bool? | trackingState | The Apple-defined tracking state for the given joint. |
ToIndex(VisionOSHandJointID)
Call .ToIndex() on a VisionOSHandJointID to get its
corresponding index into an array of joint data.
Declaration
public static int ToIndex(this VisionOSHandJointID jointId)
Parameters
| Type | Name | Description |
|---|---|---|
| VisionOSHandJointID | jointId | ID of the joint to convert to an index. |
Returns
| Type | Description |
|---|---|
| int | The index matching the ID passed in. |
TryGetVisionOSRotation(XRHandJoint, out Quaternion)
Gets the pose of the joint, if available, but without the Unity-defined change to the rotation to make the reported rotation cross-platform.
Declaration
public static bool TryGetVisionOSRotation(this XRHandJoint joint, out Quaternion rotation)
Parameters
| Type | Name | Description |
|---|---|---|
| XRHandJoint | joint | The joint this extension method extends. To call this extension
method, write it like
|
| Quaternion | rotation | If this method returns true, this will be populated with the Apple-defined rotation for the given joint, but still converted to Unity space. |
Returns
| Type | Description |
|---|---|
| bool | true if successful and the rotation was available, false otherwise. |
TryGetVisionOSTrackingState(XRHandJoint, out bool)
Gets the visinoOS-specific tracking state of the joint, if available. This tracking state will reflect whether or not the joint is visible. If the hand is tracked as a whole, every joint will have at least an estimated pose, regardless of whether it is visible. The trackingState exposed by XR Hands API will always report Pose tracking for every joint as long as the wrist is tracked, and this API can be used to differentiate joints that are visible from joints that are hidden from view.
Declaration
public static bool TryGetVisionOSTrackingState(this XRHandJoint joint, out bool trackingState)
Parameters
| Type | Name | Description |
|---|---|---|
| XRHandJoint | joint | The joint this extension method extends. To call this extension
method, write it like
|
| bool | trackingState | If this method returns true, this will be populated with the Apple-defined tracking state for the given joint. |
Returns
| Type | Description |
|---|---|
| bool | true if successful and the rotation was available, false otherwise. |