steamvr_unity_plugin icon indicating copy to clipboard operation
steamvr_unity_plugin copied to clipboard

Haptic output must NEVER have 0 frequency or 0 amplitude

Open GabrielHare opened this issue 3 years ago • 0 comments

SETUP: Windows 10, Unity 2019.4.36f1, SteamVR Unity Plugin 2.7.3, SteamVR 1.22.13, Index + Knuckles

PROBLEM: Tested in editor only (this might also be a problem in builds). Using custom bindings for Knuckles, and SteamVR_Action_Vibration instance, vibration can be started, will play to completion, and will stop. This sequence can be performed repeatedly. However, if the vibration is stopped early by invoking Execute(0f, 0f, 0f, 0f, SteamVR_Input_Sources.Any) it will stop, but no further vibrations will be output. Furthermore, causing this issue on one controller prevents vibrations on both. No warnings or errors appeared in the Unity log.

OBSERVATION: In order to get controllers to vibrate again Unity editor must be restarted and controllers must be turned off and back on. It does not appear to be necessary to restart the SteamVR service.

OBSERVATION: The SteamVR_Action_Vibration.Execute arguments secondsFromNow and duration can be zero. However if either frequency or amplitude is 0 then this bug will be encountered.

WORK-AROUND: The expected vibration output for 0 frequency or 0 amplitude is no vibration, so write a method that replaces 0 in either argument with a 0 duration vibration, and replaces the frequency and amplitude with non-zero values. The resulting output (no vibration) is then as expected.

GabrielHare avatar Jun 05 '22 00:06 GabrielHare