mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
101.58k stars 35.29k forks source link

Gamepad Support #19418

Open jendaz opened 4 years ago

jendaz commented 4 years ago

Is it possible to add Gamepad support for controllers. It is well documented and I guess quite useful to get interaction for all buttons, touch pad, thumbstick on controllers. https://immersive-web.github.io/webxr-gamepads-module/

PS: It looks like I don't have permission to add label Enhancement

mrdoob commented 4 years ago

How do you think the API should look like?

jendaz commented 4 years ago

I would expect, that you can subscribe to button state change and axes change on controller.gamepad for example. Then in event there will be directly the ThreeButton or ThreeAxes that will have reference to gamepad.

ThreeGamepad can have:

ThreeButton should contain:

ThreeAxes should be remapped to:

This is just a quick overview that I have in my mind now. I'm not a JS developer, but I would expect interface something like that. What do you thing? Is it interesting for you or someone to work on?