Hand Feature¶
Introduction¶
VIVE Wave™ XR plugin provides the Hand feature in the XRSDK and Essence packages. (refer to Wave XR Plugin Packages).
Note
If compile errors caused by the Hand feature occur when importing the Essence Package to an existed project, back up and remove the files that have errors.
After reimporting the Essence Package, recover the backup files and fix the errors.
Modify AndroidManifest.xml¶
To enable the Hand Tracking feature, you have to add below content to your AndroidManifest.xml.
<uses-feature android:name="wave.feature.handtracking" android:required="true" />
VIVE Wave™ XR plugin defines the hand joint as:
Unity XR Hand Interface¶
Unity XR provides the Bone and HandFinger data.
You can access the data through the Wave.OpenXR.InputDeviceHand interface which is included in the XRSDK package.
Before accessing the Unity XR Hand data, you have to enable Hand Tracking by either
- Using the following code
Wave.OpenXR.InputDeviceHand.ActivateNaturalHand(true);
Note
Please refer to Hand Tracking Reference Guide about the InputDeviceHand API.
- Or select the option: Project Settings > XR Plug-in Management > WaveXRSettings > Enable Natural Hand.
Note
The AndroidManifest.xml in your project will be modified automatically if you select this option.
If you need the Hand Tracking feature but don’t want to modify the AndroidManifest.xml, you should NOT select this option.
You can call the ActivateNaturalHand
function instead and modify the AndroidManifest.xml manually.
Wave Hand Manager¶
The HandManager is included in the Essence package.
You can see the sample of Hand at Assets > Wave > Essence > Hand > Model.
Note
To run the VIVE Wave™ XR plugin sample in VIVE Focus3, you have to enable VIVE Wave™ XR plugin from Project Settings > XR Plugin-in Management > Android tab > Wave XR.
To use the VIVE Wave™ XR plugin Hand feature in your scene, add the HandManager component from the menu item Wave > GameObject > Add Hand Manager.
Gesture Options
: Default disabled. Selects to start the Hand Gesture by default with required DEFAULT gesture types in runtime.Initial Start Natural Hand
: Default disabled. Selects to start the Hand Tracking by default in runtime and will consume additional power.Use XR Device
: Default disabled. When this option is enabled, HandManager will retrieve the hand pose data from Unity XR Hand Interface.
Wave Hand Tracking¶
Note
Please refer to Hand Tracking Reference Guide about the HandManager API.
By adding the JointPose component to an object and setting the Joint
, the pose of a specific bone will be applied to an object.
If Hide When Pose Invalid
is selected, the object will be hidden when the specific joint position is invalid.
Wave Hand Gesture¶
Note
Please refer to Hand Gesture Reference Guide about the Hand Gesture API.
VIVE Wave™ XR plugin provides the Hand Gesture interface.
Before using the Hand Gesture API, add the HandManager component from the menu item Wave > GameObject > Add Hand Manager.
To retrieve the DEFAULT Gesture
types, you have to select the Gesture Options > Initial Start
to enable the Hand Gesture feature by default and specify required types.
You can simply retrieve the current DEFAULT hand gesture by using following code.
using Wave.Essence.Hand;
// Retrieves the right hand default gesture.
HandManager.GestureType defaultType = (
HandManager.Instance != null ?
HandManager.Instance.GetHandGesture(false) : HandManager.GestureType.Invalid
);
You can customize gesture types by adding the CustomGestureProvider component along with HandManager. You can refer to the sample Assets > Wave > Essence > Interaction > Mode > {version} > Demo > NaturalHand for the usage of Hand Gesture.
You can simply retrieve the current DEFAULT or CUSTOM hand gesture by using following code.
using Wave.Essence.Hand.StaticGesture;
// Retrieves the right hand DEFAULT or custom gesture.
string customType = WXRGestureHand.GetSingleHandGesture(false); // false: Right, true: Left
// Retrieves the dual hand custom gesture. No DEFAULT dual hand gesture.
string dualhandType = WXRGestureHand.GetDualHandGesture();
Note
When using the WXRGestureHand
functions, the default gesture types have higher priority than custom types. You will retrieve a custom gesture type only when no default gesture type is matched.
You can register an event listener which listens GestureType to On Left Gesture
or On Right Gesture
of Custom Gesture Provider.
You can customize a gesture type by right-clicking on the Project folder > Create > Wave > Single/Dual Hand Gesture.
Customize Single-Hand Gesture¶
Single-hand gesture attributes contains:
- Name
- ThumbState
- FingerState
- Distance between Tip / Wrist
- Palm rotation: Yaw, Pitch and Roll
Customize Dual-Hand Gesture¶
Dual-hand gesture attributes contains:
- Name
- Customize Single-Hand Gesture attribute:
Left Condition
andRight Condition
- Distance between tips of different hands.
Porting from SDK 3.2.0 to SDK 4.0.0¶
The table lists the SDK 4.0.0 APIs and their counterparts in SDK 3.2.0: