I am making a first-person game using Babylon.js and I'm trying to add a feature where the player can sprint (camera.speed is increased) when holding SHIFT, but SHIFT doesn't trigger the keydown event, so I was wondering if there is a way to add this trigger, either with Babylon or just with Javascript.
How to tell if Shift key is being held down
50 views Asked by Keaden Knight At
1
I ended up figuring it out. What I had to do was create an action manager attached to the scene, then add a trigger for when the shift key was pressed. Here's the final code:
This would also work for CTRL, if you wanted to use it for crouch or some other function, you would just change
parameter: 17.