Use shift key with scene.actionmanager


Recently I’ve been trying to port my DOM keydown events to the babylon.js action manager. Playground:

Playground lines 241-262 are the new keydown functions with the action manager, and playground lines 261-318 are the DOM events. With the DOM events using keycodes, I can use the shift key. With the action manager, I’m not sure how. (I’m surprised that the space key works! check out line 245!)

Any help appreciated!



check line 238 :

scene.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnKeyDownTrigger, function (evt) {
    if(evt.sourceEvent.shiftKey) {
        alert("shift key pressed");

evt.sourceEvent returns a KeyboardEvent - Web APIs | MDN

Thanks a lot!

I’m used to DOM events.