Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity wants to learn about your experiences working on a Unity project today. We'd like to hear from you via this survey.
    Dismiss Notice
  3. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  4. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  5. Read here for Unity's latest plans on OpenXR.
    Dismiss Notice

Input System: Correct bindings for Oculus controller 'thumbstick' input?

Discussion in 'AR/VR (XR) Discussion' started by moosefetcher, Feb 6, 2020.

  1. moosefetcher

    moosefetcher

    Joined:
    Sep 23, 2015
    Posts:
    74
    Hi there.
    I'm a couple days into trying to get the new Input System package working and I've got a few questions about the Input Actions menu.
    I am trying to use an Oculus controller's thumbstick to control movement.
    I've created a Input Actions Asset and named it 'Controls'.
    I've added an Action Map called 'Player'.
    In the Actions panel, I've added an action called 'Movement'.
    To this I've added a '2d Vector Composite' binding.
    For each of the Up, Down, Left and Right options in the action I've added bindings in the Properties panel, to XR Controller > XR Controller (LeftHand) > Optional Controls > joystick.

    Is any of this right? Is any of this wrong?

    I've also added a Movement script to my player GameObject, added a PlayerInput component and set that Actions object to the 'Controls' Input Actions Asset I've been describing above. Then I've also set Behaviour to 'Invoke Unity Events' and set up the Movement event (in the Events > Player dropdown) to the Movement.Move function. All on the advice of a couple YouTube tuts.

    With so many steps, it's impossible to know which part (or parts) is/are not correct.
    Any pointers much appreciated!
     
  2. moosefetcher

    moosefetcher

    Joined:
    Sep 23, 2015
    Posts:
    74
    Hi again.
    I've actually got it working with the WASD keys, so I'm hoping I've isolated the problem to the paths I'm using in the Action > Properties panel.

    Does anyone know what the correct path is (in the InputActions editor window) to listen for input from an Oculus touch thumbstick?

    Also, it looks to me like the 2019.3 documentation doesn't include the new Input System Package. Am I right in reading it that way?
    https://docs.unity3d.com/Manual/xr_input.html
    I will also continue the research.
     
    Last edited: Feb 7, 2020
    zonoscope likes this.
  3. Clavus

    Clavus

    Joined:
    Jun 6, 2014
    Posts:
    46
    I'm still exploring the new input system myself, but from what I can tell you shouldn't us the "2d Vector Composite". You should set the "Movement" input action to output a value of Vector2D, then add a simple input binding to the thumbstick. Now the Movement input binding should return the thumbstick axis output.
     
    zonoscope and Mickwa like this.
  4. moosefetcher

    moosefetcher

    Joined:
    Sep 23, 2015
    Posts:
    74
    Oh my god. That has finally worked!
    I swore I had tried everything. Thank you so much for the reply!
     
  5. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,088
    If you try to use XR Interaction Package with this, everything breaks it seems.
     
  6. Mickwa

    Mickwa

    Joined:
    May 9, 2014
    Posts:
    11
    For me it worked with XR Interaction Toolkit (0.9.3 preview).
    It looks like to have events performed HMD must be put on, and focus on Game window must be set.
     
    ROBYER1 likes this.
  7. Dan-Gilbert

    Dan-Gilbert

    Joined:
    Dec 27, 2012
    Posts:
    8
    Thanks Clavus .

    I too have spent all afternoon trying to run with 2d Vector Composite.


    concise setup of Input System
    then swap out 2d Vector Composite Action to..

    Actions
    Action Type : Value
    Control Type: Vector 2
    AddBinding
    Properties: Binding: Path
    XR Controlller : thumbstick

    Allows me to translate object in Unity XR build with Touch joystick on Quest.
     
    sfike, norkel and abi17124 like this.
  8. abi17124

    abi17124

    Joined:
    Feb 16, 2020
    Posts:
    6

    This worked perfectly, thanks for the help!
     
  9. Matt_D_work

    Matt_D_work

    Unity Technologies

    Joined:
    Nov 30, 2016
    Posts:
    189
    they should work totally fine together, as the "Feature API" that we use actually peeks at the data stream which ends up in the new input system. if you've got more info on that we'd love to hear it.
     
  10. Holonautic_Nemanja

    Holonautic_Nemanja

    Joined:
    Nov 19, 2018
    Posts:
    1
    I'm trying to create an action and bind it to the trigger button on my Oculus Rift Touch controller. I tried setting the action to Button and also to Value/Axis, and for the binding I used: XR Controller -> Oculus Touch Controller -> Oculus Touch Controller (Right Hand) -> triggerPressed, and I tried playing with setting various interactions.

    I'm always getting the same thing: the "performed" event fires as soon as I make the slightest contact with the trigger button. Essentially, it's acting like triggerTouched, rather than waiting for me to fully press the trigger, as it should.

    I'm using serialized InputActionMap variables on a ScriptableObject as the place where my actions and bindings are defined. Bindings to simple buttons on the Touch controller (A, B, X, Y...) work normally.

    Am I doing something wrong or is this a bug?
     
    Last edited: Aug 18, 2020
    Butter_Bean likes this.
  11. WavyRancheros

    WavyRancheros

    Joined:
    Feb 5, 2013
    Posts:
    123
    I am having the same problem, it doesn't work for me.

    I have an Oculus Quest 1 controller, and a Vive controller. For both I got the trigger and the grip buttons to work.

    For the Vive controller, "primary2DAxis" works and gives me my Vector2.

    But for the Oculus Quest controller, nothing seems to work. I tried joystick, touchpad, trackpad, thumbstick, primary2Daxis, secondary2Daxis.

    thumstick [Right Hand Oculus Touch Controller] also does not work.

     
  12. WavyRancheros

    WavyRancheros

    Joined:
    Feb 5, 2013
    Posts:
    123
    I restarted the project, and now Primary2DAxis works on both Oculus and Vive. I wasted 4 hours on this.
     
  13. WavyRancheros

    WavyRancheros

    Joined:
    Feb 5, 2013
    Posts:
    123
    Now, Primary2DAxisClick does not work on either Oculus or Vive. I'm getting mad.

    *edit*
    PrimaryAxis2DClick does not work on Oculus or Vive controllers.

    This is the setup that works:

    trackpadClicked for Vive, and thumbstickClicked for Oculus.
     
    Last edited: Jan 28, 2021
  14. Ommageden

    Ommageden

    Joined:
    Sep 24, 2020
    Posts:
    7

    Exact same issue
     
  15. cutecenter

    cutecenter

    Joined:
    Nov 10, 2017
    Posts:
    2
    managed to get per axis working on Oculus Quest 2:

    1. Set Action Type to Value, Control Type to Stick
    upload_2021-3-5_16-18-11.png

    2. Then set path to below as shown
    upload_2021-3-5_16-18-58.png

    3. Edited code to output some values
    upload_2021-3-5_16-19-57.png

    4. Then assign the actions and test. (Remember to save input asset, or set to Auto-save)
    upload_2021-3-5_16-20-45.png

    Managed to get normalized output now from both axis.
     
  16. Muskie

    Muskie

    Joined:
    Jan 21, 2017
    Posts:
    81
    You want triggerButton.
     
  17. henymeny

    henymeny

    Joined:
    Apr 19, 2014
    Posts:
    8
    This.

    also note action type Button didn't work well for me! I used action type pass-through and control type Button!
     
  18. keanine

    keanine

    Joined:
    Jul 27, 2013
    Posts:
    14
    After a lot of trial and error I got my thumbstickClicked working. I made a button action, added thumbstickClicked and ReadValue<float>(). It doesn't output bool values and .triggered doesn't get set to true. Hope that helps!
     
unityunity