docs.unity3d.com
    Show / Hide Table of Contents

    Struct XRHandJoint

    Represents a joint of an XRHand.

    Namespace: UnityEngine.XR.Hands
    Syntax
    public struct XRHandJoint
    Remarks

    The term "joint" should be taken loosely in this context. In addition to the anatomical finger joints, the list of joints includes the fingertips, a point on the palm and a point on the wrist. See XRHandJointID for the full list of joints.

    Refer to Hand data model for a description of the joint locations and the data they contain.

    Properties

    handedness

    Denotes which hand this joint is on.

    Declaration
    public readonly Handedness handedness { get; }
    Property Value
    Type Description
    Handedness

    Right or left.

    id

    The ID of this joint.

    Declaration
    public readonly XRHandJointID id { get; }
    Property Value
    Type Description
    XRHandJointID

    The joint ID.

    trackingState

    Represents which tracking data is valid.

    Declaration
    public readonly XRHandJointTrackingState trackingState { get; }
    Property Value
    Type Description
    XRHandJointTrackingState

    A flag is set for each valid type of data. If the The WillNeverBeValid flag is set when this joind ID isn't supported by the hand data provider.

    Methods

    ToString()

    Returns a string representation of the XRHandJoint.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    String representation of the value.

    Overrides
    ValueType.ToString()

    TryGetAngularVelocity(out Vector3)

    Retrieves the joint's angular velocity vector, if available

    Declaration
    public bool TryGetAngularVelocity(out Vector3 angularVelocity)
    Parameters
    Type Name Description
    Vector3 angularVelocity

    Assigned the tracked angular velocity of this joint, if successful. Set to zero, if unsuccessful.

    Returns
    Type Description
    Boolean

    Returns true if successful and the angular velocity filled out with valid tracking data, returns false otherwise.

    Remarks

    To transform to world space so that the vector has the correct direction relative to the user, rotate this by the rotation of the XROrigin.

    TryGetLinearVelocity(out Vector3)

    Retrieves the joint's linear velocity vector, if available.

    Declaration
    public bool TryGetLinearVelocity(out Vector3 linearVelocity)
    Parameters
    Type Name Description
    Vector3 linearVelocity

    Assigned the tracked linear velocity of this joint, if successful. Set to zero, if unsuccessful.

    Returns
    Type Description
    Boolean

    Returns true if successful and the velocity was filled out with valid tracking data, returns false otherwise.

    Remarks

    To transform to world space so that the vector has the correct direction relative to the user, rotate this by the rotation of the XROrigin.

    TryGetPose(out Pose)

    Retrieves the joint's pose, if available.

    Declaration
    public bool TryGetPose(out Pose pose)
    Parameters
    Type Name Description
    Pose pose

    Assigned the tracked pose of this joint, if successful. Set to identity, if unsuccessful.

    Returns
    Type Description
    Boolean

    Returns true if successful and the joint pose was filled out with valid tracking data, returns false otherwise.

    Remarks

    Joint poses are relative to the real-world point chosen by the user's device.

    To transform to world space so that the joint appears in the correct location relative to the user, transform the pose based on the XROrigin.

    Examples

    The following example illustrates how to transform a pose into world space using the transform from the XROrigin object in a scene.

    public Pose ToWorldPose(XRHandJoint joint, Transform origin)
    {
        Pose xrOriginPose = new Pose(origin.position, origin.rotation);
        if (joint.TryGetPose(out Pose jointPose))
        {
            return jointPose.GetTransformedBy(xrOriginPose);
        }
        else
            return Pose.identity;
        }

    TryGetRadius(out Single)

    Retrieves the joint's radius, if available.

    Declaration
    public bool TryGetRadius(out float radius)
    Parameters
    Type Name Description
    Single radius

    Assigned the tracked radius of this joint, if successful. Set to zero, if unsuccessful.

    Returns
    Type Description
    Boolean

    Returns true if successful and the radius was filled out with valid tracking data, returns false otherwise.

    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023