Class XRHandDevice
An InputDevice that surfaces common controller data populated by hand joint poses. Devices will only be created if hand-tracking is enabled in the build settings for the target platform.
Inherited Members
Namespace: UnityEngine.XR.Hands
Assembly: Unity.XR.Hands.dll
Syntax
[InitializeOnLoad]
[Preserve]
[InputControlLayout(stateType = typeof(XRHandDeviceState), displayName = "XR Hand Device", commonUsages = new string[] { "LeftHand", "RightHand" })]
public class XRHandDevice : TrackedDevice
Remarks
The devicePosition and deviceRotation inherited from TrackedDevice represent the wrist pose.
Use the XROrigin in the scene to position and orient the device
and gesture poses properly. If you are using this data to set the Transform of a GameObject in
the scene hierarchy, you can set the local position and rotation of the Transform and make
it a child of the CameraOffset object below the XROrigin. Otherwise, you can use the
Transform of the CameraOffset to transform the data into world space.
Properties
aimActivateReady
Whether the fingers to perform the aim activate gesture are properly tracked by the hand tracking device and the hand shape is observed to be ready to perform or is performing an aim activate gesture.
Declaration
public ButtonControl aimActivateReady { get; }
Property Value
| Type | Description |
|---|---|
| ButtonControl |
aimActivateValue
An AxisControl that indicates the extent to which a user activated the aim action on the target that the user is pointing at with the aim pose.
Declaration
public AxisControl aimActivateValue { get; }
Property Value
| Type | Description |
|---|---|
| AxisControl |
aimActivated
ButtonControl that indicates whether or not the user activated the aim action on the target that the user is pointing at with the aim pose.
Declaration
public ButtonControl aimActivated { get; }
Property Value
| Type | Description |
|---|---|
| ButtonControl |
aimIsTracked
Represents whether the aim pose is fully tracked or unavailable/simulated.
Declaration
public ButtonControl aimIsTracked { get; }
Property Value
| Type | Description |
|---|---|
| ButtonControl |
Remarks
Fully tracked means that the pose is accurate and not using any simulated or extrapolated positions, and the system tracking this pose is able to confidently track this object.
aimPosition
Position of the aim pose, representing an aiming ray cast to a target. When transformed relative to the XROrigin, the position will be in the correct position in the scene relative to the user.
Declaration
public Vector3Control aimPosition { get; }
Property Value
| Type | Description |
|---|---|
| Vector3Control |
aimRotation
Rotation of the aim pose, representing an aiming ray cast to a target. When transformed relative to the XROrigin, the rotation will be in the correct orientation in the scene relative to the user.
Declaration
public QuaternionControl aimRotation { get; }
Property Value
| Type | Description |
|---|---|
| QuaternionControl |
aimTrackingState
Tracking status of the aim position and rotation. See InputTrackingState for more.
Declaration
public IntegerControl aimTrackingState { get; }
Property Value
| Type | Description |
|---|---|
| IntegerControl |
graspFirm
ButtonControl that indicates whether or not the user is making a fist.
Declaration
public ButtonControl graspFirm { get; }
Property Value
| Type | Description |
|---|---|
| ButtonControl |
graspReady
Whether the hand performing the grasp action is properly tracked by the hand tracking device and it is observed to be ready to perform or is performing the grasp action.
Declaration
public ButtonControl graspReady { get; }
Property Value
| Type | Description |
|---|---|
| ButtonControl |
graspValue
AxisControl that indicates the extent to which a user is making a fist.
Declaration
public AxisControl graspValue { get; }
Property Value
| Type | Description |
|---|---|
| AxisControl |
gripIsTracked
Represents whether the grip pose is fully tracked or unavailable/simulated.
Declaration
public ButtonControl gripIsTracked { get; }
Property Value
| Type | Description |
|---|---|
| ButtonControl |
Remarks
Fully tracked means that the pose is accurate and not using any simulated or extrapolated positions, and the system tracking this pose is able to confidently track this object.
gripPosition
Position of the grip pose, representing the palm. When transformed relative to the XROrigin, the position will be in the correct position in the scene relative to the user.
Declaration
public Vector3Control gripPosition { get; }
Property Value
| Type | Description |
|---|---|
| Vector3Control |
gripRotation
Rotation of the grip pose, representing the palm. When transformed relative to the XROrigin, the rotation will be in the correct orientation in the scene relative to the user.
Declaration
public QuaternionControl gripRotation { get; }
Property Value
| Type | Description |
|---|---|
| QuaternionControl |
gripTrackingState
Tracking status of the grip position and rotation. See InputTrackingState for more.
Declaration
public IntegerControl gripTrackingState { get; }
Property Value
| Type | Description |
|---|---|
| IntegerControl |
leftHand
Left-hand InputDevice that contains InputControls that surface common hand data populated by hand joint poses.
Declaration
public static XRHandDevice leftHand { get; }
Property Value
| Type | Description |
|---|---|
| XRHandDevice |
pinchIsTracked
Represents whether the pinch pose is fully tracked or unavailable/simulated.
Declaration
public ButtonControl pinchIsTracked { get; }
Property Value
| Type | Description |
|---|---|
| ButtonControl |
Remarks
Fully tracked means that the pose is accurate and not using any simulated or extrapolated positions, and the system tracking this pose is able to confidently track this object.
pinchPosition
Position of the pinch pose, representing the thumb's tip. When transformed relative to the XROrigin, the position will be in the correct position in the scene relative to the user.
Declaration
public Vector3Control pinchPosition { get; }
Property Value
| Type | Description |
|---|---|
| Vector3Control |
pinchReady
Whether the fingers used to perform the "pinch" gesture are properly tracked by the hand tracking device and the hand shape is observed to be ready to perform or is performing a "pinch" gesture.
Declaration
public ButtonControl pinchReady { get; }
Property Value
| Type | Description |
|---|---|
| ButtonControl |
pinchRotation
Rotation of the pinch pose, representing the thumb's tip. When transformed relative to the XROrigin, the rotation will be in the correct orientation in the scene relative to the user.
Declaration
public QuaternionControl pinchRotation { get; }
Property Value
| Type | Description |
|---|---|
| QuaternionControl |
pinchTouched
ButtonControl that represents whether or not a pinch action is actively occurring.
Declaration
public ButtonControl pinchTouched { get; }
Property Value
| Type | Description |
|---|---|
| ButtonControl |
pinchTrackingState
Tracking status of the pinch position and rotation. See InputTrackingState for more.
Declaration
public IntegerControl pinchTrackingState { get; }
Property Value
| Type | Description |
|---|---|
| IntegerControl |
pinchValue
AxisControl that represents the extent to which the user is bringing their finger and thumb together to perform a "pinch" gesture.
Declaration
public AxisControl pinchValue { get; }
Property Value
| Type | Description |
|---|---|
| AxisControl |
pokeIsTracked
Represents whether the poke pose is fully tracked or unavailable/simulated.
Declaration
public ButtonControl pokeIsTracked { get; }
Property Value
| Type | Description |
|---|---|
| ButtonControl |
Remarks
Fully tracked means that the pose is accurate and not using any simulated or extrapolated positions, and the system tracking this pose is able to confidently track this object.
pokePosition
Position of the poke pose, representing the index finger's tip. When transformed relative to the XROrigin, the position will be in the correct position in the scene relative to the user.
Declaration
public Vector3Control pokePosition { get; }
Property Value
| Type | Description |
|---|---|
| Vector3Control |
pokeRotation
Rotation of the poke pose, representing the index finger's tip. When transformed relative to the XROrigin, the rotation will be in the correct orientation in the scene relative to the user.
Declaration
public QuaternionControl pokeRotation { get; }
Property Value
| Type | Description |
|---|---|
| QuaternionControl |
pokeTrackingState
Tracking status of the poke position and rotation. See InputTrackingState for more.
Declaration
public IntegerControl pokeTrackingState { get; }
Property Value
| Type | Description |
|---|---|
| IntegerControl |
rightHand
Right-hand InputDevice that contains InputControls that surface common hand data populated by hand joint poses.
Declaration
public static XRHandDevice rightHand { get; }
Property Value
| Type | Description |
|---|---|
| XRHandDevice |
wristIsTracked
Represents whether the wrist pose is fully tracked or unavailable/simulated.
Declaration
public ButtonControl wristIsTracked { get; }
Property Value
| Type | Description |
|---|---|
| ButtonControl |
Remarks
Fully tracked means that the pose is accurate and not using any simulated or extrapolated positions, and the system tracking this pose is able to confidently track this object.
wristPosition
Position of the wrist pose. When transformed relative to the XROrigin, the position will be in the correct position in the scene relative to the user.
Declaration
public Vector3Control wristPosition { get; }
Property Value
| Type | Description |
|---|---|
| Vector3Control |
wristRotation
Rotation of the wrist pose. When transformed relative to the XROrigin, the rotation will be in the correct orientation in the scene relative to the user.
Declaration
public QuaternionControl wristRotation { get; }
Property Value
| Type | Description |
|---|---|
| QuaternionControl |
wristTrackingState
Tracking status of the wrist position and rotation. See InputTrackingState for more.
Declaration
public IntegerControl wristTrackingState { get; }
Property Value
| Type | Description |
|---|---|
| IntegerControl |
Methods
ExecuteCommand(InputDeviceCommand*)
Declaration
protected override long ExecuteCommand(InputDeviceCommand* commandPtr)
Parameters
| Type | Name | Description |
|---|---|---|
| InputDeviceCommand* | commandPtr |
Returns
| Type | Description |
|---|---|
| long |
Overrides
FinishSetup()
Perform final initialization tasks after the control hierarchy has been put into place.
Declaration
protected override void FinishSetup()