-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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_just_pressed
flickers when action is tied to an input axis (joystick direction)
#81975
Comments
not 100% sure but I think that if you assign two keys to an action (say, the left key on your keyboard and the left dpad of a controller), pressing them together can only be tracked correctly that way. |
In that case I can't understand intentions of the developers:
Then what is the point of having this counter anyway? It won't count the amount of concurrent presses, and line 731 will be meaningless as well - as the maximum is 1. I can see how the bug lies in there and would love to fix it, but I'll wait to hear from others what's the idea of that counter because there may be something that I'm missing. |
The counter tracks how many different keys are pressed, that are bound to the same Action.
That is to make sure that input from a single Axis can affect the counter only once. The jittering likely got introduced in this PR: #80859 (comment) CC @KoBeWi. |
Makes sense, I'll look into it. |
To expand on this, an axis can press an action multiple times in a row without releasing it. This is because axis events come with a strength and they count as pressed when the strength is above deadzone. You can get multiple events with strength above deadzone. |
It ended up being a fairly simple issue, the assignments of pressed_frame were in the wrong scope; it works perfectly now. |
Use |
Pressed tick assignments were in the wrong scope, resulting in updating `pressed_frame` even when it shouldn't and therefore the `just_pressed` would return true every time that the strength changes and not only when there's a new valid press. Fixes godotengine#81975.
Godot version
4.2.dev5
System information
linux, wired switch pro controller
Issue description
may be related to #81170 (as before that, my axes were getting stuck, but since then I get this bug). (although I didn't bisect or anything, I just remember that)
I have an action tied to an input axis (a joystick direction).
This happens as I move my joystick in the direction of the action:
simplescreenrecorder-2023-09-20_13.57.30.webm
(red circle is deadzone)
Steps to reproduce
Input.is_action_just_pressed("your_action")
in_process
Minimal reproduction project
axis_jittering.zip
The text was updated successfully, but these errors were encountered: