Closed andreasplesch closed 1 year ago
According to the WebXR Gamepad API spec: https://www.w3.org/TR/webxr-gamepads-module-1/#example-mappings, gamepad.axes[0] and gamepad.axes[1] are supposed to be the x and y value of touch pad on controllers, quest devices do not have a touch pad, so the value being null or undefined is expected.
If you are looking for the joystick x and y value, they are gamepad.axes[2] and gamepad.axes[3]
Also, according to the spec: https://www.w3.org/TR/webxr-gamepads-module-1/#xr-standard-heading, none of the axes values are required.
@andreasplesch I am closing this issue now, feel free to reopen this if my comments did not fully address your concerns.
Thanks. But I think you may have missed
https://www.w3.org/TR/webxr-gamepads-module-1/#xr-standard-heading
Devices that lack one of the optional inputs listed in the tables above MUST preserve their place in the buttons or axes array, reporting a placeholder button or placeholder axis, respectively. A placeholder button MUST report 0 for value, false for pressed, and false for touched. A placeholder axis MUST report 0.
So instead of null or undefined the placeholder value must be 0.
This is to make it compatible with
https://w3c.github.io/gamepad/#dom-gamepad-axes
which states:
All axis values MUST be linearly normalized to the range [-1.0 .. 1.0].
as well as https://www.w3.org/TR/gamepad/#dfn-axes
A [sequence](https://webidl.spec.whatwg.org/#idl-sequence) of [double](https://webidl.spec.whatwg.org/#idl-double) values representing the current state of axes exposed by this device
Unfortunately I cannot reopen the issue. Please let me know if I should file a new issue.
Oops! You got me there. I will put up a fix soon!
Glad to help !
This should now be fixed, you can get the fix now by building from source, or you can wait til next week when we push an update. Thanks again for flagging this!
xrFrame.session.inputSources[n].gamepad.axes[0] can be
undefined
even though the gamepad object exists and is not null.This apparently happens for the Quest Pro emulator, perhaps as a result of using a polyfill.
The Mozilla extension reports a number as required by the gamepad spec.