Is there a way to detect motion controls in JavaScript?

176 views Asked by At

Is there a way to detect motion controls from a JoyCon in vanilla JavaScript? If it's not possible, would I be able to use another API besides Gamepad API?

window.addEventListener("gamepadconnect", function(e) {
  //How would I detect motion controls?
});
1

There are 1 answers

0
nondebug On

Gamepad Extensions describes motion inputs for gamepads, but it's not officially part of the specification and no browsers implement it for Switch controllers.

It's possible to access Joy-Con motion inputs with WebHID.