Hii,
So I’ve been trying to get the bugs out of the project I’ve been working on. When I run this file locally everything just works (WASD, arrowkeys, U&I-key).
However, when I upload the project to CodePen these keys don’t work anymore. Can anyone tell if this is a Three.js related problem?
I did find this example: https://codepen.io/sencerarslan/pen/ZJjdrW which is also working with the arrowkeys. Can anyone tell me where it’s going wrong? And maybe suggestions what I can do to fix this?
Thanks!
Hi, can you show your project on CodePen?
The problem might be that Codepen works with iframes, and you need to click on the appropriate iframe to give it focus to capture the keyboard events:
- If you run the code locally, the script is executed on the entire window, so all keyboard events are captured by the window.
- If you run the code in Codepen, you need to click on the iframe that has your executed code before it can capture keyboard events.
1 Like
Oh I’m sorry, my bad.
This is the project I’m working on:
https://codepen.io/biancalooijen/pen/JeXdZo