Preface: I’m new to Babylonjs and Development in general, and may have missed/not understood some parts of the docs in relation to this topic, but I thought this might be a quick thing to add to it, to help fellow noobs like me
Custom WASD + EQ Keyboard controls can be added scene’s camera like this:
this.camera.attachControl(this.canvas, true);
this.camera.keysUpward.push(69); //increase elevation
this.camera.keysDownward.push(81); //decrease elevation
this.camera.keysUp.push(87); //forwards
this.camera.keysDown.push(83); //backwards
this.camera.keysLeft.push(65);
this.camera.keysRight.push(68);
*The above was written for Typescript.
*Insert this inside of the createScene
function.
The number inside .push()
is a Keycode.
You can find the Keycode of any keyboard key stroke on this handy website: https://keycode.info/