Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -1 to the set of allowed indices #158

Open
wants to merge 6 commits into
base: gh-pages
Choose a base branch
from

Conversation

Manishearth
Copy link
Member

@Manishearth Manishearth commented Dec 28, 2021

Closes immersive-web/webxr-gamepads-module#27

The WebXR module constructs Gamepads that are not exposed via navigator.getGamepads(), this adds a -1 value for index that can accomodate them.


Preview | Diff

@nondebug
Copy link
Collaborator

Gamepad API has been rewritten to use algorithms in the time since the WebXR issue was filed. Now there are algorithmic steps for selecting a gamepad index and constructing a Gamepad, but these steps assume we're connecting a "traditional gamepad" (as WebXR describes it) and should not be used to initialize XR gamepads. WebXR should define new steps for constructing a Gamepad from an XR input source.

Since the requirements in the "index attribute" description are already defined in the algorithm for initializing the attribute, let's remove the duplicate information so the description is correct regardless of how the attribute is initialized. Maybe just the first sentence is okay?

The index of the gamepad in the {{Navigator}}, if it is exposed via {{Navigator/getGamepads()}}.

Actually, this is incorrect since a Gamepad object retains its index after it's disconnected and no longer exposed by getGamepads(). Let's keep it simple and let the algorithms define what the behavior is. If we need to add more information, put it in a non-normative block.

The index of the gamepad.

@Manishearth
Copy link
Member Author

@nondebug Thanks! How about now?

@Manishearth
Copy link
Member Author

r? @nondebug

@himorin
Copy link

himorin commented Oct 5, 2022

@nondebug hi, this issue remains as a sole blocker for WebXR gamepads API to CR. any update on this?

@nondebug nondebug self-assigned this Oct 5, 2022
@siusin
Copy link
Contributor

siusin commented Apr 4, 2023

@nondebug ping?

@marcoscaceres
Copy link
Member

We discussed this during the editor's meeting. We would prefer not to add this to our spec and it should just be part of WebXR.

@Manishearth
Copy link
Member Author

We discussed this during the editor's meeting. We would prefer not to add this to our spec and it should just be part of WebXR.

"It should just be a part of WebXR" isn't quite clear: currently WebXR sets it to -1 which is not actually allowed by this spec. Should we say that we are modifying the Gamepads spec? Or should we do something else here?

The use case of "gamepads that are not in navigator.getGamepads() seems real and unhandled by this spec as written.

@marcoscaceres
Copy link
Member

Ok, we will take another look at the editor's meeting and see if we can suggest figure out a path forward.

@nondebug
Copy link
Collaborator

nondebug commented Feb 9, 2024

We discussed this and decided to refactor the "A new gamepad" algorithm to take an index parameter, which can be undefined (in which case we will use the "selecting an unused gamepad index" algorithm). Then WebXR Gamepads module can create the Gamepad with index initialized to -1.

@Manishearth
Copy link
Member Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

negative value for gamepad id
5 participants