Bug #4233

W and A keys override S and D Keys

Added by Luke D 5 months ago. Updated 20 days ago.

Target version:
Start date:
% Done:


Operating system:


The W and A keys seem to be dominant. For example, if you hold down W then hold S(while still holding W) you keep going forward at the same speed instead of stopping. The same goes for the A and D key. If you hold A and then D, you keep going left instead of stopping. This is set to low priority because it might not cause many troubles, but I thought it might not be intended.

Associated revisions

Revision 41f89c84 (diff)
Added by Alexei Dobrohotov 28 days ago

Don't move the player if opposite direction keys are held down at the same time (Fixes #4233)


#1 Updated by Luke D 5 months ago

I know some games make it so that if you hold W then S (while still holding W, S overrides the W because it is more recent, and you go backwards. Here you continue going forward in that case.

#2 Updated by Alexander Nadeau 5 months ago

There are three normal ways of handling inputs the "point" in opposite directions:

1: Null the input if both keys are pressed. The same as if you were using WASD to emulate an analog stick. Pressing AD at the same time would center the horizontal stick, not pick some direction.

2: Null input cancelling. Pressing and holding A, then pressing and holding D, will result in "right" being detected. Releasing D will then give you the "left" input that you've been holding this entire time. When both keys are depressed, the most recently pressed one is used, otherwise any pressed one of the two is used. However, this is typically not implemented with a queue or stack, just by using a state system for inputs instead of checking which ones are pressed each frame, and having appropriate logic.

3: When it's part of the game logic. Sometimes holding left and right at the same time isn't the same as holding just one of them or neither, but has its own special state, like having higher or lower friction than not pressing anything at all, but not having any acceleration.

#3 Updated by Alexei Dobrohotov 4 months ago

  • Category set to Input

#4 Updated by Alexei Dobrohotov 29 days ago

  • Status changed from New to Confirmed
  • Assignee set to Alexei Dobrohotov
  • Reproducibility changed from Have not tried to Always
  • Operating system changed from Windows to Other

A_MoveLeft and A_MoveForward actions take priority over A_MoveRight and A_MoveBackward actions in the keyboard movement code. Joystick movement which works the same way is fine, because you obviously can't hold the stick in two directions simultaneously. I have some ideas.

#5 Updated by Alexei Dobrohotov 29 days ago

  • Status changed from Confirmed to Resolved
  • Target version set to openmw-0.44
  • % Done changed from 0 to 100

#6 Updated by Alexei Dobrohotov 28 days ago

Morrowind engine also has this issue, so yay.

#7 Updated by Alexei Dobrohotov 20 days ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF