Ejemplo n.º 1
0
        public float GetAxis(int axisID)
        {
            if (axisID == 0 || axisID == 1)
            {
                //Index/Hand trigger is mapped as a button in WebXR
                WebXRControllerButton b = GetControllerButton(axisID);
                return(b != null ? b.value : 0);
            }

            return(axisID < GetNumAxes() ? _axesValues[axisID] : 0);
        }
Ejemplo n.º 2
0
 // Updates button states from Web gamepad API.
 private void UpdateButtons(WebXRControllerButton[] buttons)
 {
     for (int i = 0; i < buttons.Length; i++)
     {
         WebXRControllerButton button = buttons[i];
         foreach (WebXRControllerInput input in inputMap.inputs)
         {
             if (input.gamepadId == i)
             {
                 SetButtonState(input.actionName, button.pressed, button.value);
             }
         }
     }
 }