I’m working in a simple FPS game with the Babylon 4 version that uses the Universal Camera, but I’m with a problem that I can’t find the solution (I spent some hours on It but no success).
When I enter the scene, I can’t use the keyboard until I press f12 (Eg: if I press f12 to show the console, then I press f12 again to hide, and then I can use the keyboard to move the camera). I’ve tested with Chrome and Firebox browsers.
I thought at first that the scene was loading before the keyboard listeners are prepared, but all my application is running inside the DOMContentLoaded event listener, then I think that this is not the problem.
If It can help, here is the Scene code: simple-3d-fps/FirstLevel.js at master · TiagoSilvaPereira/simple-3d-fps · GitHub
I discovered that if I load the First Level scene firstly, instead of the Menu scene, the issue does not occur. I think that the problem occurs because I am calling this code before loading a new scene:
I noticed too that:
- If I click out of the browser and then click in the browser again, It works.
- If I add the Scene Inspector to debug the scene, It works well too
- It occurs with 3.3 version too
Does someone know what is happening?
Thanks for helping!!