-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyboardDragListener: How should multiple pressed direction keys behave? #1655
Comments
Yes, this seems reasonable to me. I have observed the same behavior in other 2d games I have played. The behavior comes from this bit in KeyboardDragListener, the delta is just a sum from the pressed keys. scenery/js/listeners/KeyboardDragListener.ts Lines 491 to 506 in 0364817
|
I like that design! Makes sense and I just wanted to double check since it is different from native browser key event behavior.
This is not always the exact behavior I see. In buoyancy, when dragging a block, if I hold both left/right keys, the block correctly stays still, but when I then add up arrow the block buggily stays still. This doesn't happen when I add the down arrown as the third key, in which the block does correctly (given the spec above) move down. |
I see, thanks - I can reproduce that for the arrow keys but not the WASD keys. That is a bug, Ill take a look. |
So it turns out this is actually happening at the hardware level and is called "key ghosting". I was alerted because we don't even get the DOM event in BrowserEvents. But you can see it really clearly happening here (and for other combinations too). https://www.microsoft.com/applied-sciences/projects/anti-ghosting-demo I am afraid the best we can do is document this so it isn't a surprise next time. |
I added a line of documentation. @zepumph seem OK or do you think it would be better somewhere else? |
Very cool! Thanks |
While testing for phetsims/scenery-phet#869, I was surprised to see that if I alternate pressing left and right arrow keys, but make sure that the old one stays down until well after the new one is pressed, I was surprised to see that the new one doesn't take precedent. @jessegreenberg does this seem like reasonable behavior to you? Are you aware of this issue and I'm just late to the party?
We should decide mostly if this blocks Buoyancy. Adding to the project board.
The text was updated successfully, but these errors were encountered: