Search Unity

Oculus Go controller mapping

Discussion in 'AR/VR (XR) Discussion' started by Lokiare, Feb 20, 2019.

  1. Lokiare

    Lokiare

    Joined:
    Nov 2, 2014
    Posts:
    9
    I've searched and searched and was unable to find how the Oculus Go controller maps to the built in controls in Unity (i.e. edit->project settings->input).

    What I did was assign each button/axis to a named control of the button/axis name (i.e. "joystick button 0" = "button 0" and "joystick axis X" = "axis 1"). Then put it in a text mesh so I could see the values for each.

    What I've found is:
    Trigger = button 15 (its also an axis but returns only 1 or 0, nothing in-between)
    Back = button 7
    TouchPad Pressed = button 9
    TouchPad Touch Vertical = 5th Axis
    TouchPad Touch Horizontal = 4th Axis

    The angle of the controller is not on any of the 28 axis that Unity gives us access to.

    I'm posting this because I couldn't find it anywhere and it might help others save time.
     
  2. Deleted User

    Deleted User

    Guest

    Exactly what I was looking for, but I think the touch for the PrimaryTouchpad is missing. It's capable of detecting touch, press and the axis inputs.
     
    Last edited by a moderator: Feb 28, 2019
  3. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,983

    This link describes how to get the angle (orientation) of the controller for the GO:

    https://developer.oculus.com/documentation/unity/latest/concepts/unity-ovrinput/

    TLDR:

    GetLocalControllerRotation() returns a quaternion which is the controller orientation. You can then use it as you wish for any input based stuff or anything else
     
    Nadoc_NewLedge likes this.
  4. StayTalm_Unity

    StayTalm_Unity

    Unity Technologies

    Joined:
    May 3, 2017
    Posts:
    182
    You can use
    UnityEngine.XR.InputTracking.GetLocalRotation
    with the node type of
    UnityEngine.XR.XRNode.RightHand

    This is because your controller is set to right-handed at the moment. But for production you will want to handle both left and right handed controllers, so you may need to check for both right and left hands via InputTracking.GetNodeStates

    The reason the axes are bounced around like that is or consistency, we've tried to map like controller features to the same axis and button values for OpenVR, WindowsMR and Oculus, which for simpler controllers can make them appear to bounce around a bit. They are also mapped similarly to an XBox controller on a PC, such that the right stick on a controller maps to the right touchpad on an Oculus Go. For a list of which axis and button indices to use for controllers check out: XRInput Manual

    Edit: Will be updating that manual page, but I just noticed that Oculus Go is not listed. You can safely treat it as using the same indices as a GearVR device.
     
  5. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,689
    We've been working on extending the XRTK with Oculus support and this one certainly is curious.

    You can only use the KeyCode definitions when using Input.GetKey (e.g. Input.GetKey.KeyCode.JoystickButton15)
    ONLY USE JoystickButtonxx (no joystick number) (see below)

    To expand on the above

    • Trigger = button 15
    • Trigger = Axis 10 (but also 3?) 1 or 0 no range.
    • Back = button 7
    • Touchpad Touch = button 17
    • TouchPad Pressed = button 9
    • TouchPad Touch Vertical = 5th Axis
    • TouchPad Touch Horizontal = 4th Axis

    Warning!
    When you hit the back button, Unity spawns a second joystick, which isn't the controller?
    For this reason, you CANNOT use "joystick button 0" = "button 0" notation or KeyCode.Joystick1Button15. as it will stop working when the user hits the back button.
     
    EricWal and PatHightreeXVR like this.
  6. Nick-Nexefy

    Nick-Nexefy

    Joined:
    Mar 20, 2019
    Posts:
    8
    What method do people use access the Oculus Go's track pad. When using Input via the 4th and 5th axes respectively for the horizontal and vertical axes respectively, it seems to only return -1 or 1 values for each axis. Basically indicating which quadrant your thumb is in but no value in between.
    I'm trying this in Unity 2019.3 without the Oculus Integration from the Asset Store.
     
  7. jons190

    jons190

    Joined:
    Sep 13, 2016
    Posts:
    260
    I just got easy input for the gearvr and Go plugin and it works great with 2018.4lst and the oculus integration. gives a few out of box solutions for thumpad management. (for my fps shooter on the Go)
    https://assetstore.unity.com/packag...nt/easy-input-for-gear-vr-and-oculus-go-88829
     
  8. Deleted User

    Deleted User

    Guest

    @unity_ZVVVASk-TG7J1A I tihnk you're either not reading the axis with GetAxis but AxisRaw, which only returns clamped values
     
    jons190 likes this.
  9. Deleted User

    Deleted User

    Guest

    @StayTalm_Unity @SimonDarksideJ Guys, have any of you encountered that Input depends on device you're using. 2 out of 10 of our Go's fire -1 instead of 1 for the 3rd axis and they have Button 8 and 16 instead of 9 and 17 for touchpad touch and press...
    This really comes down to reading Input.GetKey directly, running the same apk on 2 of the mentioned devices