Jump to content

How to stop the vibration of controllers before exiting the app on Vive Focus 3?


Viacheslav

Recommended Posts

I'm using:
Unity version 2020.3.22
VIVE Wave XR Plugin - Version 4.4.0-r.8
XR Interaction Toolkit - Version 1.0.0-pre.8 
XR Plugin Management - Version 4.2.0
Hardware: VIVE Focus 3

The vibration is started by following methods:
Interop.WVR_TriggerVibration(deviceType, WVR_InputId.WVR_InputId_Alias1_Touchpad, (uint)(duration), (uint)frequency, intensity);
Interop.WVR_TriggerVibrationScale(deviceType, WVR_InputId.WVR_InputId_Alias1_Touchpad, (uint)(duration), (uint)frequency, impulseAmplitude);

And reseted in the same way:
Interop.WVR_TriggerVibration(deviceType, WVR_InputId.WVR_InputId_Alias1_Touchpad, 0, 0, 0f);
Interop.WVR_TriggerVibrationScale(deviceType, WVR_InputId.WVR_InputId_Alias1_Touchpad, 0, 0, 0f);

The problem is that when I quit the app when the vibration of controllers started, the app closed, but the vibration continued working. To invoke resetting of the vibration before quitting I used OnApplicationQuit(), OnApplicationPause(), OnApplicationFocus() and also tried to listen the WVR_EventType_Quit event. Also, in the Android studio's logcat I couldn't see responses from OnApplicationQuit or OnEventApplicationQuit.

private void OnEnable()
    {
        SystemEvent.Listen(WVR_EventType.WVR_EventType_Quit, OnEventApplicationQuit);
    }

private void OnDisable()
    {
        SystemEvent.Remove(WVR_EventType.WVR_EventType_Quit, OnEventApplicationQuit);
    }

private void OnEventApplicationQuit(WVR_Event_t systemEvent)
    {
        Debug.LogError("Exit");
        ResetHaptic();
    }

Edited by Viacheslav
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...