Skip to content
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

Input.is_action_pressed() inconsistent for multiple key bindings #30888

Closed
Yoshi72 opened this issue Jul 28, 2019 · 4 comments · Fixed by #30890
Closed

Input.is_action_pressed() inconsistent for multiple key bindings #30888

Yoshi72 opened this issue Jul 28, 2019 · 4 comments · Fixed by #30890

Comments

@Yoshi72
Copy link

@Yoshi72 Yoshi72 commented Jul 28, 2019

Godot version:
3.1.1

Issue description:
If assigning multiple keys to the same action, then pressing both keys at the same time and only releasing one (while still holding the second key bound to the same action) will return false for that action in Input.is_action_pressed().
It appears that Input does not check if another key is still being pressed when a key assigned to the same action is released.

Steps to reproduce:
-Create a new action in the Project Settings (e.g. "move_up")
-Assign two different keys to that action ("W" and "Up")
-Create a script that checks for Input.is_action_pressed("move_up")
-Press both assigned keys at the same time ("W" and "Up")
-Release only one while still holding the other
-Input.is_action_pressed("move_up") will now return false

Minimal reproduction project:
Input.is_action_pressed Bugreport.zip
The color of the Icon will change based on Input detected for the action "do_stuff". Please press W or Space to trigger the action.

@groud

This comment has been minimized.

Copy link
Contributor

@groud groud commented Jul 28, 2019

Might be a regression from #30792 if you are using the master branch.

@Yoshi72

This comment has been minimized.

Copy link
Author

@Yoshi72 Yoshi72 commented Jul 28, 2019

Nah, this behaviour is on both, the current stable release on steam, as well as the current master branch on github (3.2.dev).
So it's safe to say that it's unrelated to the merge you mentioned.

@KoBeWi

This comment has been minimized.

Copy link
Contributor

@KoBeWi KoBeWi commented Jul 28, 2019

#30792 didn't affect this particular case, but holds related discussion. Basically, that's how the input system works. You can detect multiple key presses on single action, but the action itself is either pressed or not. There's no "button count action strength" that would count number of pressed buttons for that action and that's probably by design.

@Yoshi72

This comment has been minimized.

Copy link
Author

@Yoshi72 Yoshi72 commented Jul 28, 2019

If that is by design, then so be it. I don't mind. But I would reocmmend, to update the docs to make this clear.
https://docs.godotengine.org/en/3.1/classes/class_input.html#class-input-method-is-action-pressed

bool is_action_pressed ( String action ) const
Returns true if you are pressing the action event.

There is no mentioning of how it should behave with multiple keybinding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.