Class XRHandJointIDUtility
Houses extension and utility methods for XRHandJointID.
Namespace: UnityEngine.XR.Hands
Syntax
public static class XRHandJointIDUtility
Methods
FromIndex(Int32)
Call this to get the corresponding XRHandJointID from an index into an array of associated data.
Declaration
public static XRHandJointID FromIndex(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index to convert to an ID. |
Returns
Type | Description |
---|---|
XRHandJointID | The ID matching the index passed in. |
GetBackJointID(XRHandFingerID)
Gets the tip XRHandJointID of a given XRHandFingerID.
Declaration
public static XRHandJointID GetBackJointID(this XRHandFingerID fingerId)
Parameters
Type | Name | Description |
---|---|---|
XRHandFingerID | fingerId | ID of the finger you want the last XRHandJointID of. |
Returns
Type | Description |
---|---|
XRHandJointID | Last XRHandJointID for the given finger in an XRHand object's list of joints. |
Remarks
Use with GetFrontJointID(XRHandFingerID) to iterate through the joints of a finger.
GetFrontJointID(XRHandFingerID)
Gets the metacarpal XRHandJointID of a given XRHandFingerID.
Declaration
public static XRHandJointID GetFrontJointID(this XRHandFingerID fingerId)
Parameters
Type | Name | Description |
---|---|---|
XRHandFingerID | fingerId | ID of the finger of which you want the first XRHandJointID. |
Returns
Type | Description |
---|---|
XRHandJointID | First XRHandJointID for the given finger in an XRHand object's list of joints. |
Examples
You can use GetFrontJointID
and GetBackJointID(XRHandFingerID) to iterate
through the joints of a specific finger:
for(var i = XRHandFingerID.Thumb.GetFrontJointID().ToIndex(); // metacarpal
i <= XRHandFingerID.Thumb.GetBackJointID().ToIndex(); // tip
i++)
{
// hand is an XRHand object
XRHandJoint fingerJoint = hand.GetJoint(XRHandJointIDUtility.FromIndex(i));
// Use data...
}
ToIndex(XRHandJointID)
Call .ToIndex()
on a XRHandJointID to get its
corresponding index into an array of joint data.
Declaration
public static int ToIndex(this XRHandJointID jointId)
Parameters
Type | Name | Description |
---|---|---|
XRHandJointID | jointId | ID of the joint to convert to an index. |
Returns
Type | Description |
---|---|
Int32 | The index matching the ID passed in. |