docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class XRHandProviderUtility

    Utility methods for a provider to a XRHandSubsystem.

    Inheritance
    object
    XRHandProviderUtility
    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.ProviderImplementation
    Assembly: Unity.XR.Hands.dll
    Syntax
    public static class XRHandProviderUtility

    Methods

    CreateHand(Handedness, Allocator)

    Create and initialize a new XRHand instance. This method offers direct control over hand creation, bypassing the XRHandSubsystem.

    Declaration
    public static XRHand CreateHand(Handedness handedness, Allocator allocator)
    Parameters
    Type Name Description
    Handedness handedness

    Indicates whether to create a left or right hand.

    Allocator allocator

    The allocator to use for native memory allocation of the XRHandJoint data.

    Returns
    Type Description
    XRHand

    A new XRHand instance.

    Remarks

    You shouldn't need to create XRHand manually if you are using XRHandSubsystem. This function is more for advanced scenarios where you wish to use XRHand independent of XRHandSubsystem. Most applications should access hands through the subsystem's leftHand and rightHand properties instead. Refer to Access hand data for details.

    CreateJoint(Handedness, XRHandJointTrackingState, XRHandJointID, Pose, float, Vector3, Vector3)

    Create a fully configurable joint with at least a pose in hand space, tracking state, and ID.

    Declaration
    public static XRHandJoint CreateJoint(Handedness handedness, XRHandJointTrackingState trackingState, XRHandJointID id, Pose pose, float radius = 0, Vector3 linearVelocity = default, Vector3 angularVelocity = default)
    Parameters
    Type Name Description
    Handedness handedness

    Denotes whether the joint being created is on the left or right hand.

    XRHandJointTrackingState trackingState

    The tracking state flags associated with this joint, representing which fields of the XRHandJoint are valid.

    XRHandJointID id

    The XRHandJointID of the joint. When filling out an element of an array of XRHandJoint, the index must be converted with FromIndex(int).

    Pose pose

    The pose of the joint in session space, relative to the XROrigin.

    float radius

    The radius of the joint. The default value is 0f.

    Vector3 linearVelocity

    The linear velocity of the joint in hand space (relative to the XROrigin). The default value is Vector3.zero.

    Vector3 angularVelocity

    The angular velocity of the joint in hand space (relative to the XROrigin). The default value is Vector3.zero.

    Returns
    Type Description
    XRHandJoint

    An XRHandJoint with the given pose and other supplied data.

    CreateJoint(XRHandJointTrackingState, XRHandJointID, Pose, float, Vector3, Vector3)

    Create a fully configurable joint with at least a pose in hand space, tracking state, and ID.

    Declaration
    [Obsolete("Use the CreateJoint overload that has an additional first argument for handedness. Otherwise, joints will always report as being from the left hand, even if they were from the right hand.")]
    public static XRHandJoint CreateJoint(XRHandJointTrackingState trackingState, XRHandJointID id, Pose pose, float radius = 0, Vector3 linearVelocity = default, Vector3 angularVelocity = default)
    Parameters
    Type Name Description
    XRHandJointTrackingState trackingState

    The tracking state flags associated with this joint, representing which fields of the XRHandJoint are valid.

    XRHandJointID id

    The XRHandJointID of the joint. When filling out an element of an array of XRHandJoint, the index must be converted with FromIndex(int).

    Pose pose

    The pose of the joint in session space, relative to the XROrigin.

    float radius

    The radius of the joint. The default value is 0f.

    Vector3 linearVelocity

    The linear velocity of the joint in hand space (relative to the XROrigin). The default value is Vector3.zero.

    Vector3 angularVelocity

    The angular velocity of the joint in hand space (relative to the XROrigin). The default value is Vector3.zero.

    Returns
    Type Description
    XRHandJoint

    An XRHandJoint with the given pose and other supplied data.

    DisposeHand(XRHand)

    Release resources allocated by an XRHand instance.

    Declaration
    public static void DisposeHand(XRHand hand)
    Parameters
    Type Name Description
    XRHand hand

    The XRHand instance to dispose.

    Remarks

    This method should only be called if you created the XRHand using CreateHand(Handedness, Allocator). Do not call this method on XRHand instances obtained through an XRHandSubsystem, as those are managed by the subsystem itself and will be disposed automatically. This method is a wrapper for the internal Dispose method that handles the cleanup of all native arrays allocated by the XRHand.

    In This Article
    Back to top
    Copyright © 2025 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)