docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class XRHandJointIDUtility

    Houses extension and utility methods for XRHandJointID.

    Inheritance
    object
    XRHandJointIDUtility
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.XR.Hands
    Assembly: Unity.XR.Hands.dll
    Syntax
    public static class XRHandJointIDUtility

    Methods

    FromIndex(int)

    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
    int 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
    int

    The index matching the ID passed in.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)