Description
I’m using code like this for player movement:
this.app.keyboard.isPressed(pc.KEY_A)
and I’m noticing that if:
1. I’m holding 2-3 keys down (for example: A, W, S)
2. Then I hit escape (to unlock my mouse)
3. Then I release the keys I was holding (A, W, S)
4. Sometimes PlayCanvas thinks some of those keys are still pressed. The code above, keyboard.isPressed(pc.KEY_A)
, will show true
even though the key is not pressed.
- Press
A
(or any key) - Press
Escape
within milliseconds of the key above. - Release the
A
key. - PlayCanvas still thinks the
A
key is pressed.
If I click on the experience to relock my mouse, that bug will cause the player to move by themself without any keys being pressed.
This can be undone by pressing the “stuck” key again.
Anyone delt with this issue before?
I’ve heard of a hardware limitation where some combination of motherboard or keyboard can not register more than a few keypresses at the same time. I feel like that was a bigger issue like 10-20 years ago, so may not be relevant at all.
The fact that it’s dependent on me pressing escape makes me think this is an engine/browser issue rather than a hardware/OS issue.
Specs
Browser: Chrome (135)
OS: Ubuntu 24.10
Rendering: WebGL 2, Wayland