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 device orientation support #211

Open
jdarpinian opened this issue Jul 22, 2024 · 2 comments
Open

Add device orientation support #211

jdarpinian opened this issue Jul 22, 2024 · 2 comments
Labels
feature request TPAC2024 Topic for discussion at TPAC 2024

Comments

@jdarpinian
Copy link

It would be nice to have gyro support. Flick Stick controls are becoming more popular and they can't be implemented on the web today. https://en.wikipedia.org/wiki/Flick_Stick

@nondebug
Copy link
Collaborator

Gamepad Extensions defines a GamepadPose interface, but as far as I'm aware it was never implemented in any browser engine. It was proposed as a way to expose motion inputs for WebXR API but WebXR maintainers ultimately decided to create their own interface.

I think we should not add GamepadPose to Gamepad API as it is today. Currently, Gamepad API doesn't prompt the user before exposing access to gamepads. Instead, the API returns no information about gamepads until a gamepad user gesture is received. This works well enough for legacy gamepads which typically don't generate any inputs unless the user is physically interacting with the device, but modern gamepads include sensors that continuously generate inputs until the device is disconnected. I think users would not expect a website to have continuous access to gamepad motion inputs just because they pressed a button on a gamepad, so some additional user consent step is needed.

Other web platform APIs already expose access to motion sensors, we should try to leverage these APIs instead of building new gamepad-specific interfaces:

Chromium implements a motion sensors site permission (chrome://settings/content/sensors), perhaps we can gate gamepad motion inputs on that permission.

@marcoscaceres marcoscaceres changed the title Gyro Add device orientation support Jul 25, 2024
@jdarpinian
Copy link
Author

I see the gyro/accelerometer inputs as roughly equivalent to the control sticks from a user expectations point of view. They do not generate events or count as user gestures, but once the gamepad is connected to a page their values are monitored and continuously sent to the webpage even if the user is not actively moving them, until page reload. For example, if the gamepad is resting upside down on its control sticks they might report some off-center values, and if the gamepad is jostled those values might change even if the user is not actively using the gamepad. I don't think this is surprising to users for the control sticks and I don't think it would be surprising to users for the gyro/accelerometer either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request TPAC2024 Topic for discussion at TPAC 2024
Projects
None yet
Development

No branches or pull requests

3 participants