Search Unity

How do you stop SteamVR_Action_Vibrate?

Discussion in 'AR/VR (XR) Discussion' started by unity_CmzqIOgMRopC4Q, Jun 12, 2019.

  1. unity_CmzqIOgMRopC4Q

    unity_CmzqIOgMRopC4Q

    Joined:
    Apr 5, 2019
    Posts:
    13
    Hello everyone.

    I have written the following method to output a haptic action/vibration to the controller:
    Code (CSharp):
    1. public SteamVR_Action_Vibration hapticAction;
    2.  
    3. private void Pulse(float duration, float frequency, float amplitude, SteamVR_Input_Sources source)
    4. {
    5.     hapticAction.Execute(0, duration, frequency, amplitude, source);
    6. }
    This will trigger the hapticAction for a specific amount of time. But I was wondering if there is any way to stop the hapticAction?

    Because what I want to do is that if a user touches the button in my VR game, the controller will vibrate (in the OnTriggerEnter). When the controller goes out of the button (in the OnTriggerExit), the hapticAction has to stop.