License requirement
The functionality described requires a MANUS Bodypack
or a MANUS license dongle
with one of the following licenses:
Core Pro
Core XR
Demo
, or a Feature
license with the OpenXR
feature enabled.
Finger haptics
OpenXR does not natively support finger haptics for glove devices. To enable haptics for finger tracking, the MANUS OpenXR API Layer provides an extension to enable the use of finger haptics. This article explains how to implement finger haptics in OpenXR applications.
Prerequisites
Please make sure to have read the getting started guide for the MANUS OpenXR API Layer. Make sure it's installed and functional. For more information, please refer to the Getting Started guide.
Implementation
The feature is modeled after the xrApplyHapticFeedback function in the OpenXR API, intended for input devices. The MANUS OpenXR API Layer provides a function to apply haptic feedback to the fingers of the glove devices. The function is called xrApplyHapticFeedbackMANUS
.
The xrApplyHapticFeedbackMANUS function is defined as:
XrResult xrApplyHapticFeedbackMANUS(XrSession session,
XrDuration duration,
XrHandEXT side,
XrMANUSFingerAmplitudes amplitudes);
typedef struct XrMANUSFingerAmplitudes {
float thumb;
float index;
float middle;
float ring;
float pinky;
} XrMANUSFingerAmplitudes;
Parameters
session
is the XrSession to start outputting to.duration
is the XrDuration of the haptic feedback in nanoseconds.side
is the XrHandEXT to apply the haptic feedback to.amplitudes
is the XrMANUSFingerAmplitudes struct containing the amplitude for each finger in a range from 0.0 to 1.0.
Description
Trigger a haptic event on the specified hand with the specified duration and amplitude for each finger. The amplitude is a float value between 0.0 and 1.0, where 0.0 is no haptic feedback and 1.0 is the maximum haptic feedback.
If another haptic event for the same hand is happening when this function is called, the new event will override the old event.
Unity
For Unity, haptics can be added through OpenXR by making use of our OpenXRUnityHaptics
Unity package. This package can be found as part of our Unity Plugin.
Import the OpenXRUnityHaptics
Unity package into your project.
Enable the MANUS Haptics Extension
in Edit->Project Settings->OpenXR
.
The unitypackage includes MANUSOpenXRHapticsSample.cs
as an example demonstrating how to call our haptics function.
Get the MANUSOpenXRHapticsFeature
from the OpenXRSettings.
private MANUSOpenXRHapticsFeature m_MANUSOpenXRHapticsFeature;
private void Start()
{
m_MANUSOpenXRHapticsFeature = OpenXRSettings.Instance.GetFeature<MANUSOpenXRHapticsFeature>();
}
The Haptics can now be activated through VibrateHand
.
m_MANUSOpenXRHapticsFeature.VibrateHand(-1, XrHandEXT.XR_HAND_RIGHT_EXT, new FingerAmplitudes(1, 1, 1, 1, 1));
This function has the following parameters:
p_Duration
is the duration of the vibration in nanoseconds. The shortest duration we support at this time is 50000000 nanoseconds (50ms). Alternatively, -1 can be used to vibrate the shortest duration possible.p_Side
is the side of the hand to vibrate.p_Amplitudes
is the intensity of the vibration per finger. We support values between 0 (no vibration) and 1 (maximum vibration).