Grabbing keyboard event on scene.registerBeforeRender

Hi there. What is the correct call for keyboards with the scene.registerBeforeRender(function(evt) {

});

the evt.shiftKey is not working, whereas scene.onPointerDown has this call

It is not entirely clear what you are asking. There is no event passed to registerBeforeRender. There is for onPointerDown.

Generally, if you want to handle keyboard events, you would use scene.onKeyboardObservable. Here is an example of using UP/DOWN arrow keys that react differently when SHIFT is held.

2 Likes

I just saw your earlier forum post, so I now better understand what you are trying to do. Here is an example that uses the scene render loop to react depending on if SHIFT key is pressed or has been let go (clicked).

3 Likes

problem solved. Thank you!