Search Unity

Question OpenXR Primary2DAxisClick not working

Discussion in 'VR' started by Rasnor, Jun 4, 2021.

  1. Rasnor

    Rasnor

    Joined:
    Feb 27, 2019
    Posts:
    7
    Hi,

    I am currently trying to bind primary2DAxisClick with the new Input System.
    For testing I use an HTC Vive Pro Eye.
    When looking into the documentation https://docs.unity3d.com/Manual/xr_input.html
    primary2DAxisClick should be triggered when I click the touchpad of the Vive controller.

    However nothing happened when I clicked the touchpad (a bit similar to this thread, but without any errors)
    To check if my setup is wrong I tested a few other bindings (see screenshot):
    unity_primary2daxis_binding_2.png
    The exact paths were:
    <XRController>{RightHand}/gripPressed - works
    <XRController>{RightHand}/primary2DAxisClick - no event
    <XRController>{RightHand}/primary2DAxisTouch - no event
    <XRController>{RightHand}/triggerButton - works

    It seems my setup is working (as grip and triggerButton are recognized) but primary2DAxisClick and primary2DAxisTouch seem not to be recognized.
    I also looked into the XRInteractionDebugger, here primary2DAxisClick and primary2DAxisTouch change their state accordingly. Which is even more confusing :).
    unity_primary2daxis_xrdebugger_2.png


    So in summary for primary2DAxisClick/Touch no event seem to be sent.
    Do I maybe need to setup something differently for the primary2dAxisClick binding? Perhaps I am missing something.
    Maybe I have used the wrong paths?
    Does recently anyone else have encountered the same problem?

    ---
    My Unity version is 2021.1.10f1
    XR Interaction Toolkit 1.0.0-pre.4
    Device: HTC Vive Pro Eye

    This is the script I used for testing the bindings of my InputAction:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.InputSystem;
    3.  
    4. public class DebugOpenXRAction : MonoBehaviour
    5. {
    6.     public InputActionReference dbgInputActionReference;
    7.  
    8.     // Start is called before the first frame update
    9.     void Start()
    10.     {
    11.         dbgInputActionReference.action.performed += InputActionPerformed;
    12.         dbgInputActionReference.action.started += InputActionStarted;
    13.         dbgInputActionReference.action.canceled += InputActionCancel;
    14.     }
    15.     // Update is called once per frame
    16.     void Update()
    17.     {
    18.         // nothing to do
    19.     }
    20.  
    21.     private void InputActionCancel(InputAction.CallbackContext obj)
    22.     {
    23.         Debug.Log("dbg InputActionCancel");
    24.     }
    25.  
    26.     private void InputActionStarted(InputAction.CallbackContext obj)
    27.     {
    28.         Debug.Log("dbg InputActionStarted");
    29.     }
    30.  
    31.     private void InputActionPerformed(InputAction.CallbackContext obj)
    32.     {
    33.         Debug.Log("dbg InputActionPerformed");
    34.     }
    35.  
    36.  
    37. }
     
  2. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Try binding to the following, note the
    {
    and
    }
    .

    Code (CSharp):
    1. <XRController>{RightHand}/{primary2DAxisClick}
    2. <XRController>{RightHand}/{primary2DAxisTouch}
    Primary2DAxisTouch is a "usage" which has to be bound using the usage syntax which is wrapping it in {}. You can find more information on the binding syntax here.

    If that still doesnt work for you please let me know.
     
  3. Rasnor

    Rasnor

    Joined:
    Feb 27, 2019
    Posts:
    7
    Thank you, I wasn't aware of this notation difference :).
    Especially as I only used the GUI for setting up the bindings.
    With this adjustment, the events are also sent for Click and Touch.

    I initially came to this binding-path (without the curly brackets) over the dropdown menu:
    XR Controller > XR Controller (Right Hand) > Optional Controls > primary2DAxisClick

    binding_process_1_.png
    which inserts the binding-path without the mentioned usage notation:
    <XRController>{RightHand}/primary2DAxisClick

    -> which will not work :)

    Is this a bug? or maybe intentional?

    Another thing about the usage syntax is confusing me, as some paths such as for the TriggerButton:
    <XRController>{RightHand}/triggerButton

    and
    <XRController>{RightHand}/{triggerButton}

    work fine with and without the usage-syntax.

    Which is confusing asTiggerButton is also a usage (such as primary2DAxisClick) but it does work without the usage-syntax.
     
  4. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    I would say if the GUI set up the binding that way then that is a bug. As far as I can tell the other XR plugins such as Oculus also use
    primary2DAxisClick
    as a usage.

    For
    triggerButton
    I think it is because trigger button is also an alias? I will see if I can get someone who understands the InputSystem a little better to give a better answer.
     
  5. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Which XR plugins do you have installed? I am not seeing
    primary2DAxisClick
    in the menus anywhere. Could you take a screenshot of where you are finding it for me? Still looking into why triggerButton works as both a usage and as a control/alias.
     
  6. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    For
    triggerButton
    it looks like both a usage and an alias is specified for the original control which is actually
    triggerPressed
    . The usage will work with the {} and the alias acts as if the control were named that, so in that case it works with or without the {}. That may all sounds pretty confusing and really, it is. This confusion comes from trying to make the OpenXR controller profiles as backwards compatible as possible with the non OpenXR equivalents. Hope that helps
     
  7. Rasnor

    Rasnor

    Joined:
    Feb 27, 2019
    Posts:
    7
    Ah ok thank you, this explains why it is working for some of the bindings.
    Then its probably best for now to always check if the gui sets up the correct path (with the {}) for usages (in case there is no alias set).


    if it is still of help:

    I only have the OpenXR plugin 1.2.2 installed.
    (Under XR Plug-in Management also only OpenXR is selected)
    xr_packages_.png

    XR Controller > XR Controller (Right Hand) > Optional Controls > primary2DAxisClick
    binding_path_setup.png
    => when selecting over the gui a path without the {} is set.
     
  8. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    That is interesting. When I use the dialogs that doesnt exist for me, wonder what is adding it. Which controller profiles do you have set up in the OpenXR settings?
     
  9. Rasnor

    Rasnor

    Joined:
    Feb 27, 2019
    Posts:
    7
    I have set up the
    • Eye Gaze,
    • HTC Vice Controller
    • and Oculus Touch Controller
    controller_profiles_.png
     
  10. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    We are at a loss where that binding is coming from. Aside from sharing your project with us so we can track it down not sure what else to do. If you want you can submit a bug with it and attach your project and we should be able to track it down from that. I know it isnt really impacting you though, so this would mainly be to just make sure nobody else runs into it and get confused.
     
  11. Rasnor

    Rasnor

    Joined:
    Feb 27, 2019
    Posts:
    7
    I just noticed, while setting up a new project
    for me primary2DAxisClick was only added in the UI after importing the "XR Interaction Toolkit"-Plugin to the project
     
  12. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    That must be it! Thank you for tracking that down!
     
  13. Rasnor

    Rasnor

    Joined:
    Feb 27, 2019
    Posts:
    7
    When I use the search function for the bindings:
    It also seem to have added 3 bindings (LeftHand, RightHand and Simulated) for primary2DAxisClick and Touch
    When I select one of those it is in the notation without the {}.

    new_bindings_by_interaction_toolkit_.png
    When I Select the one marked [Any] (which was always there) it is in the correct notation with the {}
     
  14. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Thank you for digging into that, that is exactly the issue. The XRI package has a simulated device that is exposing these controls. Those controls end up having confusing names because they mirror the actual usages that other controls use. We will look into making this less confusing in the future.
     
  15. Rasnor

    Rasnor

    Joined:
    Feb 27, 2019
    Posts:
    7
    Thank you for your help :), I would have never noticed the error in the binding-path.

    I assume the mentioned bug report that I should open is now not needed anymore?
     
  16. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    That is correct, we are on it.
     
  17. agarciaESS

    agarciaESS

    Joined:
    Feb 2, 2018
    Posts:
    1
    Thank you! I was having the same issue, and edited the path to include the curly brackets to get it working.

    In case it matters, I am using:
    Unity: 2020.3.15f2
    XR Interaction Toolkit: 2.0.0
     
  18. korzen303

    korzen303

    Joined:
    Oct 2, 2012
    Posts:
    223
    This is stilll the case for 2.2.0, so annoying...
     
  19. DarkSoulsBoss2

    DarkSoulsBoss2

    Unity Technologies

    Joined:
    Mar 24, 2023
    Posts:
    23
    A fix for this was accepted this week, you should be able to specify usages per-controller layout in the next release, as well as view some diagnostic information to ensure that the binding path provided matches the device binding path you are targetting.
     
    Farl_Lee likes this.