Hand orientation
Hand orientation is the rotation of the hand relative to a user or an object in the scene.
To define a hand orientation, you choose an axis of the hand, a reference direction to compare it to, and how the two directions must be aligned. These properties are described in the following sections:
- Hand axis: a direction relative to the hand
- Reference direction: a direction relative to the user, another object, or the XR Origin.
- Alignment: how the two directions must be aligned.
When you define a custom gesture, you can specify whether the hand must be in a particular orientation in either a Hand Pose asset or a Static Hand Gesture component. The difference is that you can only specify target-relative reference directions in a static hand gesture component (because you need a reference to a GameObject in the scene to set a target).
Hand axis
For specifying an orientation, the axes of the hand are defined relative to the extended fingers, extended thumb, and the palm of the hand.
Fingers Extended Direction | Thumb Extended Direction | Palm Direction |
---|---|---|
This hand axis points in the same direction as the fully extended fingers (along the proximal-distal line of the hand). |
This hand axis points in the same direction as the fully extended thumb (along the radial-ulnar -- also known as medial-lateral -- line of the hand). The thumb extended direction is always referenced to the thumb, so it points the opposite direction on the left hand compared to the right hand. However, this allows you to use the same hand poses for both hands. |
This hand axis points in the direction the palm is facing (along the palmar-dorsal line of the hand). |
Reference direction
The reference direction is the direction to which to compare the chosen axis of the hand when determining if the hand is in the desired orientation to recognize a gesture. For example, if your gesture requires that the user's palm faces the user, then you could choose the Palm Direction as the hand axis and Hand to head as the reference direction (and set the other orientation properties as appropriate).
There are two different contexts in which you might specify a reference direction for a gesture. In a Hand Pose asset, you can specify a direction relative to either the XR Origin or the user. In a Static Hand Gesture component, you can specify a direction relative to a target GameObject in the same scene as the component.
In a hand pose, you can choose one of the following user-relative reference directions:
- Origin up: the direction of the positive y axis of the XR Origin.
- Hand to Head: the direction from the hand toward the user's head.
- Nose Direction: the direction in which the user's face is pointing.
- Chin Direction: the direction toward the bottom of the user's head.
- Ear Direction: the direction pointing out of the user's ear (the left ear for left-handed gestures and the right ear for right-handed gestures).
In a static hand gesture component, you can specify one of the following target-relative reference directions:
- Hand to Target: the direction from the hand toward the target.
- Target Forward: the direction along the target's local positive Z axis.
- Target Up: the direction along the target's local positive Y axis.
- Target Right: the direction along the target's local positive X axis.
Origin up
The positive Y axis of the XR Origin in a scene. Typically this is the same as the scene origin's positive Y axis and the user's physical up direction.
Every XR scene has an XR Origin object that established the center of tracking space. When you use this reference direction, the gesture detection code can implicitly find the XR Origin without needing a hard reference to the object.
Hand to Head
A direction pointing from the palm point of the hand toward the center of the user's head.
Head axis
For specifying an orientation, the axes of the head are defined relative to the face.
Chin Direction | Ear Direction | Nose Direction |
---|---|---|
A direction pointing along the head's local Y axis or downward direction. |
A direction pointing along the head's local X axis. This direction points out of the left ear for gestures of the left hand and out of the right ear for gestures of the right hand. |
A direction pointing along the head's local Z axis or forward direction. |
Hand to Target
A direction pointing from the palm point of the hand to the position of a target GameObject's Transform in a scene.
Target axis
Target orientations use the local axis of the target GameObject's transform.
Target Up | Target Right | Target Forward |
---|---|---|
A direction pointing along a target's local Y axis. | A direction pointing along a target's local X axis. | A direction pointing along a target's local Z axis. |
Alignment
You can choose from the following types of alignment to use when comparing a hand axis to a reference direction:
- Aligns With: Both directions must point in the same direction.
- Perpendicular to: The hand axis must be perpendicular to the reference direction.
- Opposite To: The hand axis must be parallel to the reference direction, but pointing in the opposite direction.
When specifying an orientation, you can set the Angle Tolerance to a value between 0.1 and 180 degrees. The two directions must be within that many degrees of each other using the chosen alignment type in order for the gesture to be recognized.
You can also choose to ignore the Y component when comparing alignment between the hand and the Hand to Head or Hand to Target reference directions. This option effectively projects the chosen hand axis and reference directions onto the X-Z plane (through the origin). For example, you could use this option so that the user only needs to point in the general, compass direction of a target object to perform a gesture, rather than directly at it.
Alignment examples
The following examples illustrate how the different alignment options affect the comparison of a hand axis to a reference direction:
Palm Direction | |||
Origin Up | |||
Target Up | |||
Aligns With | Perpendicular To | Opposite To |