Jump to content

About ViveInput.TriggerHapticPulse specification with vive focus plus


h-shirakami

Recommended Posts

I use the following SDK in unity for the development of vive focvus plus.
WaveSDK2.0.37
Viu 1.10.3

I was looking for a way to vibrate the controller.

ViveInput.TriggerHapticVibration
When I ran this API, nothing happened.

ViveInput.TriggerHapticPulse (HandRole role, ushort intensity = 500)
This API worked, but changing the intensity value doesn't change.

Is this a specification?
Or is it because the sdk version is low?

 


@chengnay

Link to comment
Share on other sites

@h-shirakami Please update your SDKs (VIU v1.10.6 from Asset Store and WaveSDK 3.1.4) to the latest version.

And add below code,

Under Assets\HTC.UnityPlugin\VRModule\Modules\WaveVRModule.cs,

line 771 after the override function TriggerViveControllerHaptic,

#if VIU_WAVEVR_3_1_0_OR_NEWER
        public override void TriggerHapticVibration(uint deviceIndex, float durationSeconds = 0.01f, float frequency = 85, float amplitude = 0.125f, float startSecondsFromNow = 0)
        {
            var deviceInput = WaveVR_Controller.Input(s_index2type[deviceIndex]);
            if (deviceInput != null)
            {
                if (0 <= amplitude || amplitude <= 0.2)
                {
                    Interop.WVR_TriggerVibration(deviceInput.DeviceType, WVR_InputId.WVR_InputId_Alias1_Touchpad, (uint)(durationSeconds * 1000000), (uint)frequency, WVR_Intensity.WVR_Intensity_Weak);
                }
                else if (0.2 < amplitude || amplitude <= 0.4)
                {
                    Interop.WVR_TriggerVibration(deviceInput.DeviceType, WVR_InputId.WVR_InputId_Alias1_Touchpad, (uint)(durationSeconds * 1000000), (uint)frequency, WVR_Intensity.WVR_Intensity_Light);
                }
                else if (0.4 < amplitude || amplitude <= 0.6)
                {
                    Interop.WVR_TriggerVibration(deviceInput.DeviceType, WVR_InputId.WVR_InputId_Alias1_Touchpad, (uint)(durationSeconds * 1000000), (uint)frequency, WVR_Intensity.WVR_Intensity_Normal);
                }
                else if (0.6 < amplitude || amplitude <= 0.8)
                {
                    Interop.WVR_TriggerVibration(deviceInput.DeviceType, WVR_InputId.WVR_InputId_Alias1_Touchpad, (uint)(durationSeconds * 1000000), (uint)frequency, WVR_Intensity.WVR_Intensity_Strong);
                }
                else if (0.8 < amplitude || amplitude <= 1)
                {
                    Interop.WVR_TriggerVibration(deviceInput.DeviceType, WVR_InputId.WVR_InputId_Alias1_Touchpad, (uint)(durationSeconds * 1000000), (uint)frequency, WVR_Intensity.WVR_Intensity_Severe);
                }
            }
        }
#endif

 

Now you can trigger vibrate by calling ViveInput.TriggerHapticVibration(role, hapticValue).

hapticValue is in seconds, if you set it to 1 sec, it will roughly be alittle bit more than 1 sec up to 2 sec.

I double check internally that Vive Focus Plus' controller does not have any intensity level, I hope this new API is enough for your development.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...