简体   繁体   English

有没有办法检测 JavaScript 中的运动控制?

[英]Is there a way to detect motion controls in JavaScript?

Is there a way to detect motion controls from a JoyCon in vanilla JavaScript?有没有办法在香草 JavaScript 中检测来自 JoyCon 的运动控制? If it's not possible, would I be able to use another API besides Gamepad API ?如果不可能,除了游戏手柄 API 之外,我还能使用另一个Gamepad API吗?

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

Gamepad Extensions describes motion inputs for gamepads, but it's not officially part of the specification and no browsers implement it for Switch controllers. Gamepad Extensions描述了游戏手柄的运动输入,但它不是规范的正式部分,也没有浏览器为 Switch 控制器实现它。

It's possible to access Joy-Con motion inputs with WebHID.可以使用 WebHID 访问 Joy-Con 运动输入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM