Search Unity

Question How to get Haptics Working in OpenVR

Discussion in 'XR Interaction Toolkit and Input' started by Ofx360, Oct 12, 2021.

  1. Ofx360

    Ofx360

    Joined:
    Apr 30, 2013
    Posts:
    155
    I'm on XRIT 1.0.0-pre6 with OpenXR 1.1.1, using the Action-Based System with Oculus Quest 2, but I can't seem to get haptics working.

    I'm not sure what action to use for the Haptic Device Action. On the XRController, I used the "<XRController>{RightHand}/*" binding path, just like the "Default Input Actions" sample. Then in the XR Ray Interactor, I set all the Haptic Events to On, with the intensity to 1 and the duration set to about 2. But no Haptics fire at all. Audio Events and Interactor Events fire just fine, so the events are working - its just the haptics that are not. Not sure if that's a bug, the sample is just incorrect, or I'm doing something wrong.

    I've tried looking for a different binding path to use, but couldn't find anything in the generic XR Controller path or the Oculus Controller path for haptics/rumble/vibration. Am I'm missing it?

    Since I wasn't having luck with XRIT's interface, I've been trying to fire the haptics via code, but i'm not seeing anything there either. I'm not exactly sure how to go about it. I looped thru the devices in InputSystem.devices, and if one of them had the XRControllerWithRumble class, i'd call SendImpulse and set the amplitude to 0.25f, 1, and 100, with a duration of 1. It didn't work. Maybe there is another way to target the haptics via code? Another possible bug?

    I'd be really helpful if anyone could clarify this for me, I'm very lost at the moment!
     
  2. kingofhypocrites_unity

    kingofhypocrites_unity

    Joined:
    Jun 19, 2020
    Posts:
    4
    I can't get this to work either. Did you ever figure this out?