Search Unity

No way to read Vive Controller's menu button using XR.InputDevice

Discussion in 'AR/VR (XR) Discussion' started by seffles, May 1, 2019.

  1. seffles

    seffles

    Joined:
    Oct 2, 2013
    Posts:
    32
    Hi,

    I was using the new input system for reading the Vive controllers directly (not using the Steam plugin, etc). We had problems with Unity failing to detect the controllers, so we started to use the legacy input. One of Unity's XR QA staff suggested we look at the XR Input API instead.

    I've got that working, but there seems to be no way to detect the Vive controller's menu button. I'm calling "XR.InputDevice.TryGetFeatureValue()" and passing in "CommonUsages.menuButton", but that doesn't work.

    Looking at the documentation here (https://docs.unity3d.com/2019.1/Documentation/Manual/xr_input.html), there seems to be no mapping to the menu button for the Vive controllers. Is this an oversight, or is it a deliberate omission?
     
  2. StayTalm_Unity

    StayTalm_Unity

    Unity Technologies

    Joined:
    May 3, 2017
    Posts:
    182
    Oh hey!
    I think someone was asking internally on your behalf about this. Or someone with the same question. Here is what I said to them:

    For some clarity as to why it's under primary and not menu, we made that decision because it was consistent with our existing button mappings. The primary Oculus and WMR buttons mapped to the same button as the Vive sandwich button, and we wanted to keep it that way. If there is only one button on a controller, it's likely to be under the Primary tag.

    If you meant the button with the 2 diamonds on it, below the touchpad, then that is reserved and we can't read it.
    Does this help?
     
    seffles likes this.
  3. seffles

    seffles

    Joined:
    Oct 2, 2013
    Posts:
    32
    Thanks for the reply. I think that was me, I raised a bug via my work account.

    It's the button above the touchpad with the horizontal lines. I expected it to be mapped to the menu button, since that's what the documentation describes it as, and how it's used in most apps. When it didn't work, I tried various other mappings to try and discover it, but must have missed primary. D'oh.

    Either way, my problem is fixed and I can finally ditch the legacy input. Thanks again for the support. :)