Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Feedback XRControllerWithRumble.SendImpulse in OpenXR is very high frequency, and therefore unpleasant

Discussion in 'VR' started by Thomas-Mountainborn, Jul 20, 2021.

  1. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    502
    When using XRControllerWithRumble.SendImpulse() in OpenXR, the controllers rumble at a very high frequency, giving off a very unpleasant buzzing noise. It's impossible to get a nice haptic tick, like when hovering over UI in the SteamVR menu. Instead, it sounds and feels like an enraged insect. The call only takes parameters for amplitude and duration, not for frequency. Is there a way around this right now, or does this need to be patched in a future version? Thanks!
     
  2. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Frequency is something that the OpenXR spec does support but not something unity has supported thus far in the haptic apis. We plan to expose frequency through some new apis that will be coming for haptics. At this point your only option for a work around would be to make your own feature and hook the openxr haptics apis so that you can inject your own frequency. This will require a native DLL to do. There is currently no ETA on this new api as we are working on the next patch release first. This will likely be in a 1.3+ release.
     
  3. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    502
    Any news on this? I've implemented OpenXR myself in an old engine, and found that OpenXR's haptics call literally takes two arguments, amplitude and frequency. It's a bit strange that it's not exposed in Unity and is instead seemingly hard-coded to the maximum frequency.
     
  4. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    It is exposed in 1.3.0 of the OpenXR Package which was released last week

    https://docs.unity3d.com/Packages/c...enXR.Input.OpenXRInput.html#SendHapticImpulse
     
    Thomas-Mountainborn likes this.
  5. Cloudwalker_

    Cloudwalker_

    Joined:
    Jan 3, 2014
    Posts:
    140
  6. Cloudwalker_

    Cloudwalker_

    Joined:
    Jan 3, 2014
    Posts:
    140
    Tried this - seems to work so far ~

    Code (CSharp):
    1.      
    2.  
    3.     UnityEngine.InputSystem.InputSystem.onDeviceChange += OnDeviceChanged;
    4.        
    5.  
    6.         private void OnDeviceChanged(InputDevice device, InputDeviceChange change)
    7.         {
    8.             if (change == InputDeviceChange.Added)
    9.             {
    10.                 if (device.usages.Contains(CommonUsages.LeftHand) && Side == HVRHandSide.Left || device.usages.Contains(CommonUsages.RightHand) && Side == HVRHandSide.Right)
    11.                 {
    12.                     _inputDevice = device;
    13.                 }
    14.             }
    15.         }
     
  7. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    502
  8. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Unfortunately most devices dont let you change the frequency, the steam index does, but I dont think the Oculus does.