Hand Tracking Sample
The Spaces Hand components have been deprecated in favor of the components in the QCHT package and will be removed in future releases. The current Hand Tracking scene in the sample application is included in the QCHT package and must be imported for the sample to work correctly.
Spaces Hand Manager
The Spaces Hand Manager component has been deprecated in favor of the components in the QCHT package and will be removed in future releases.
The Spaces Hand Manager
component is of type ARTrackableManager
and is programmed in a way that is similar to all the other managers from AR Foundation - by providing a callback function to retrieve changes in form of added, updated and removed items
public void Start() {
spacesHandManager.handsChanged += OnHandsChanged;
}
...
private void OnHandsChanged(SpacesHandsChangedEventArgs args) {
foreach (var hand in args.added) {
...
}
foreach (var hand in args.updated) {
...
}
foreach (var hand in args.removed) {
...
}
}
It also provides an inspector field to define the default prefab that should be spawned upon detecting hands. The Default Spaces Hand
prefab from the samples consists of two additional components, as seen in the image below. They are described in detail in the following sections.
Spaces Hand component
The Spaces Hand component has been deprecated in favor of the components in the QCHT package and will be removed in future releases.
This component is the common interface to get all hand related data. It is of type ARTrackable
and therefore has common properties like a TrackableID, TrackingState and a Pose that will be the defined by the tracked hand's wrist joint.
It additionally provides three more properties:
- IsLeft is a boolean returning true if the tracked hand is the left one. Otherwise, the returned value is false.
- Joints is an array of
Qualcomm.Snapdragon.Spaces.SpacesHand.Joint
types. This type has the following properties:- Pose is a Unity pose type that returns the pose of the hand joint.
- Type is of type
Qualcomm.Snapdragon.Spaces.SpacesHand.JointType
and returns an enum value, which hand joint is addressed.
- Gesture is of type
Qualcomm.Snapdragon.Spaces.SpacesHand.Gesture
and has the following properties:- Type is of type
Qualcomm.Snapdragon.Spaces.SpacesHand.GestureType
and returns an enum value, which gesture was detected for the hand. - GestureRatio is a float value between 0 and 1, indicating how much the gesture is applied.
- FlipRatio is a float value between -1 and 1, indicating if the hand gesture is detected from the back (-1), from the front (1) or in between.
- Type is of type
For more information about gestures, please refer to the interaction gestures documentation.
namespace Qualcomm.Snapdragon.Spaces.SpacesHand
{
public enum JointType
{
PALM = 0,
WRIST = 1,
THUMB_METACARPAL = 2,
THUMB_PROXIMAL = 3,
THUMB_DISTAL = 4,
THUMB_TIP = 5,
INDEX_METACARPAL = 6,
INDEX_PROXIMAL = 7,
INDEX_INTERMEDIATE = 8,
INDEX_DISTAL = 9,
INDEX_TIP = 10,
MIDDLE_METACARPAL = 11,
MIDDLE_PROXIMAL = 12,
MIDDLE_INTERMEDIATE = 13,
MIDDLE_DISTAL = 14,
MIDDLE_TIP = 15,
RING_METACARPAL = 16,
RING_PROXIMAL = 17,
RING_INTERMEDIATE = 18,
RING_DISTAL = 19,
RING_TIP = 20,
LITTLE_METACARPAL = 21,
LITTLE_PROXIMAL = 22,
LITTLE_INTERMEDIATE = 23,
LITTLE_DISTAL = 24,
LITTLE_TIP = 25
}
}
namespace Qualcomm.Snapdragon.Spaces.SpacesHand
{
public enum GestureType
{
UNKNOWN = -1,
OPEN_HAND = 0,
//FLIP = 1,
GRAB = 2,
//UP = 3,
//DOWN = 4,
//SWIPE = 5,
//SWIPE_OUT = 6,
PINCH = 7,
POINT = 8,
VICTORY = 9,
//CALL = 10,
METAL = 11
}
}
Spaces Hand Joint Visualizer component
The Spaces Hand Joint Visualizer component has been deprecated in favor of the components in the QCHT package and will be removed in future releases.
This component provides some properties to change the appearance of the joint visualization, such as:
- JointMesh is the mesh that should be instantiated for every joint.
- JointMaterial is the material that should be applied on the mesh.
- JointMeshScale is a float value between 0.005 and 0.05 and defines the scaling that should be applied to the mesh.
- UseNormalizedColors is a boolean value. If set to true, the _Color property of the applied material's shader, will be colored by the component.
In the samples, a simple sphere mesh included in the UnityEngine is set as the JointMesh as well as the Default-Material as the JointMaterial.