Comments (3)
this might be the answer: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code
from spacesvr.
Just tried this example http://output.jsbin.com/noyudo/5
From this article https://hacks.mozilla.org/2017/03/internationalize-your-keyboard-controls/
The main issue remains, for most case we can't detect the layout in order to display the right controls on page load.
We could update the WASD/ZQSD/... indicator when the user press whatever key that correspond to code='KeyW'
There is also this experimental Keyboard API that could allow us to detect the Keyboard layout in some browsers.
https://developer.mozilla.org/en-US/docs/Web/API/Keyboard_API
if (navigator.keyboard) {
var keyboard = navigator.keyboard;
keyboard.getLayoutMap()
.then(keyboardLayoutMap => {
var upKey = keyboardLayoutMap.get('KeyW');
window.alert('Press ' + upKey + ' to move up.');
});
} else {
// Do something else.
}
from spacesvr.
found this, seems like event.code is the right way?
mozilla/hubs#2397
mozilla/hubs@c544888
you probably can't explicitly detect which keyboard the user is using but just look for the keys in the right position at the very least
from spacesvr.
Related Issues (20)
- collidable component doesnt load automatically HOT 2
- SnapTurn in VR look strange HOT 2
- Tool Belt opens on mobile with inaccurate taps HOT 1
- Snapshot interpolation on multiplayer entities HOT 1
- Adaptive resolution based on fps
- Fix yarn link HOT 1
- frameColor attribute to Image component
- KTX2 texture support for images on mobile HOT 1
- Cover iPhone notch on landscape HOT 2
- Add social media link component
- New Pause Menu / UI Overhaul HOT 3
- Pause videos when outside of frustrum
- FacePlayer type is invalid HOT 2
- Fail to load texture HOT 2
- no Drei Components not working inside StandardEnvironment HOT 1
- Can't resolve 'three/examples/jsm/controls/DeviceOrientationControls' HOT 2
- Upgrade r3f, drei, 3.js, and associated packages HOT 1
- Gamepad support
- Add snap turn with q/e
- React-dom security problem in Sandbox with React 18 from link on your readme HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spacesvr.