Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

WebXR Legacy Input

Discussion in 'AR/VR (XR) Discussion' started by rtbz, May 29, 2020.

  1. rtbz

    rtbz

    Joined:
    Jan 18, 2017
    Posts:
    11
    I have my Input Manager configured with TriggerLeft + TriggerRight using Joystick Axis 9/10 as defined at both:

    https://docs.unity3d.com/Manual/xr_input.html
    and
    https://github.com/MozillaReality/unity-webxr-export/blob/master/ProjectSettings/InputManager.asset



    In my project, this never fires in WebXR:
    Code (CSharp):
    1. void Update () {
    2.         bool isSpace = Input.GetKey (KeyCode.Space);
    3.         bool isTrigger = Input.GetAxis ("TriggerLeft") > 0.8f || Input.GetAxis ("TriggerRight") > 0.8f;
    4.  
    5.         if (isSpace || isTrigger) {
    6.             // Do work
    7.         }
    8. }
    I've also tried attaching a WebXR Controller script and listening for events with:

    Code (CSharp):
    1. WebXRController controller;
    2.  
    3. void Awake () {
    4.     controller = GetComponent<WebXRController> ();
    5. }
    6.  
    7. void Update () {
    8.     if (controller != null) {
    9.         if (controller.GetButtonDown ("Trigger")) {
    10.             /* Do work */
    11.         }
    12.     }
    13. }
    But this still fails to capture Oculus Quest controller input when viewing this content from the Oculus Browser in the WebXR environment.

    What am I missing to connect these controller inputs to the loop?
     
    Last edited: May 31, 2020