Hello, I am trying to implement multiple keyboard keys input via event app.keyboard.on(“keydown”). In some combinations it wouldn’t register third pressed key. For example: pc.KEY_UP + pc.KEY_LEFT + pc.KEY_ENTER works fine, but pc.KEY_UP + pc.KEY_LEFT + pc.KEY_SPACE would not register the third key which was pressed. pc.KEY_UP + pc.KEY_RIGHT + pc.KEY_SPACE, works fine for some reason. but f.e. pc.KEY_DOWN + pc.KEY_RIGHT + pc.KEY_SPACE also doesn’t work (playcanvas register only first two keys). Here is simple example:
I am new to PlayCanvas, so apologies if what I say next is out of context…
But after playing around with your code in several different ways, and also after researching online…
This appears to be a known Javascript bug in browsers globally:
There’s most likely some workaround that I am not aware of, but for now, when I replace the arrow-key statements with W,A,S,D key statements, the code works fine.
If it is OS or hardware related problem, there will hardly be any fix. I guess I will need to use different keys in game then. Thank you for finding more information about this problem.
@RPaladin those SO posts are super old, and most probably not valid.
@Regular your project works fine for me. All combinations work, even if I press everything.
Might be related to N key roll over?
I tried other keyboards, and everything works fine on most, only some keyboards have this bug. Might be the issue with N key roll over on keyboards, as yaustar suggested. Thanks!