h-shirakami Posted October 20, 2019 Share Posted October 20, 2019 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 More sharing options...
VIVE_chengnay Posted October 21, 2019 Share Posted October 21, 2019 @h-shirakami I found out that VIU currently is using old haptic API. This API's maximum vibration time is very short. In latest WaveSDK(v3.1.4), there is new API for haptic. I will provide patch for you by tomorrow to fix this part. Link to comment Share on other sites More sharing options...
h-shirakami Posted October 21, 2019 Author Share Posted October 21, 2019 Thank you for your prompt reply. Do I need to upgrade wavesdk? @chengnay Link to comment Share on other sites More sharing options...
VIVE_chengnay Posted October 22, 2019 Share Posted October 22, 2019 @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 More sharing options...
h-shirakami Posted October 27, 2019 Author Share Posted October 27, 2019 (edited) ViveInput.TriggerHapticVibration now works Thank you so much. Edited October 27, 2019 by h-shirakami Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now