Trouble with haptic feedback on different controllers
See original GitHub issueI’m trying to add a custom haptic feedback to my controller script with custom SteamVR Input bindings. I copied the following from SteamVR’s Hand.cs code to my own controller class:
using Valve.VR;
public SteamVR_Input_Sources HandType;
public SteamVR_Action_Vibration HapticAction;
public void TriggerHapticPulse(float duration, float frequency, float amplitude)
{
HapticAction.Execute(0, duration, frequency, amplitude, HandType);
}
and called it in another function: TriggerHapticPulse(1.0f, 150.0f, 75.0f);. But upon running the game I get an error: TriggerHapticVibrationAction (/actions/Custom/out/HapticFeedback) error: InvalidHandle handle: 1152970243895722447.
I have checked and made sure that my custom SteamVR input bindings are generated, bound and saved using the binding UI.
public SteamVR_Action_Vibration HapticAction; is set to: \actions\Custom\out\HapticFeedback.
public SteamVR_Input_Sources HandType; is set to (for this example): Left Hand.
I have SteamVR_ActivateActionSetOnLoad set to my custom \actions\Custom action set.
I’m using the latest SteamVR Beta 1.2.3 on Unity 2018.3.0f2, with OpenVR 1.0.2 installed in the unity package manger.
I’ve changed SteamVR_Action_Vibration’s error logError to LogWarning for now so my whole script doesn’t break apart.
I can provide more information if needed. I’m still really new to SteamVR 2.0 so ask me to check stuff I might or might not have on my CameraRig that might be doing this.
Issue Analytics
- State:
- Created 5 years ago
- Comments:24

Top Related StackOverflow Question
Luckily is found my mistake today. It does not make much sense and I don’t think it’s related to your problem so excuse me for spamming your topic.
My problem came from the duration limit value accepted by the oculus Rift.
The duration value must be lower than 0.79f…
m_HapticAction.Execute(0f, duration, frequency, amplitude, source);
This works : m_HapticAction.Execute(0f, 0.5f, 150, 75, SteamVR_Input_Sources.LeftHand);
This don’t : m_HapticAction.Execute(0f, 0.8f, 150, 75, SteamVR_Input_Sources.LeftHand);
Here is another strange issue with haptics: SteamVR 2.0 Oculus Rift S (touch controllers) Unity 2019.2.17 I am executing haptics using the TriggerHapticPulse() on the Hand. If I reload the scene (destroying the player) the “sourceMap” for SteamVR_Action_Vibration is null and throwing lots of errors. This only happens on reload or scene changes.