Struct XRHand
Represents a hand from an XRHandSubsystem. Do not create this yourself - get hand objects from the leftHand and rightHand properties of the XRHandSubsystem.
Implements
Inherited Members
Namespace: UnityEngine.XR.Hands
Assembly: Unity.XR.Hands.dll
Syntax
public struct XRHand : IEquatable<XRHand>
Remarks
See Hand tracking for a description of the hand data model and how to access the tracking data.
Properties
handedness
Represents which hand this is.
Declaration
public Handedness handedness { get; }
Property Value
Type | Description |
---|---|
Handedness | Right, left, or invalid. |
isTracked
Whether the subsystem is currently tracking this hand's root pose and joints.
Declaration
public readonly bool isTracked { get; }
Property Value
Type | Description |
---|---|
bool | Indicates the tracking status as of the last hand data update. |
rootPose
Root pose for the hand.
Declaration
public Pose rootPose { get; }
Property Value
Type | Description |
---|---|
Pose | Located at the wrist joint, the forward vector of the hand points in the direction of the fingers. |
Methods
Equals(object)
Tests for equality.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | An object to compare against. |
Returns
Type | Description |
---|---|
bool | Returns true if |
Overrides
Equals(XRHand)
Tests for equality.
Declaration
public bool Equals(XRHand other)
Parameters
Type | Name | Description |
---|---|---|
XRHand | other | The XRHand to compare against. |
Returns
Type | Description |
---|---|
bool | Returns true if the underlying native pointers are the same. Returns false otherwise. |
GetHashCode()
Computes a hash code from all fields of XRHand.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | Returns a hash code of this object. |
Overrides
GetJoint(XRHandJointID)
Retrieves an XRHandJoint by its ID.
Declaration
public XRHandJoint GetJoint(XRHandJointID id)
Parameters
Type | Name | Description |
---|---|---|
XRHandJointID | id | ID of the required joint. |
Returns
Type | Description |
---|---|
XRHandJoint | The XRHandJoint corresponding the ID passed in. |
Remarks
The joint data is stored in an internal native array that isn't copied if you
make a shallow copy of an XRHand
object. This native array is modified each time
A hand update occurs. Calling this function from a
copied XRHand
retrieves the latest hand data, not the data from when the
hand object was copied. To take a snapshot of the joint data for use later, you must
copy each individual XRHandJoint object.
ToString()
Returns a string representation of the XRHand.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | String representation of the value. |
Overrides
Operators
operator ==(XRHand, XRHand)
Tests for equality. Same as Equals(XRHand).
Declaration
public static bool operator ==(XRHand lhs, XRHand rhs)
Parameters
Type | Name | Description |
---|---|---|
XRHand | lhs | The left-hand side of the comparison. |
XRHand | rhs | The right-hand side of the comparison. |
Returns
Type | Description |
---|---|
bool | Returns the same value as Equals(XRHand). |
operator !=(XRHand, XRHand)
Tests for inequality. Same as !Equals(XRHand)
Declaration
public static bool operator !=(XRHand lhs, XRHand rhs)
Parameters
Type | Name | Description |
---|---|---|
XRHand | lhs | The left-hand side of the comparison. |
XRHand | rhs | The right-hand side of the comparison. |
Returns
Type | Description |
---|---|
bool | Returns the negation of Equals(XRHand). |