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

Replace default deadzone magic number with named constant and fix InputEventJoypadMotion::set_axis_value unresponsiveness #99135

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

Meorge
Copy link
Contributor

@Meorge Meorge commented Nov 12, 2024

Closes #98982.

In #97281, the default deadzone for input actions was changed from 0.5 to 0.2. Apparently this instance of 0.5 slipped through the cracks, so controller sticks were often not surpassing the threshold for their action to be considered "pressed".

The PR now replaces all instances of the 0.2 default deadzone magic number (that I know of) with a constant, InputMap::DEFAULT_DEADZONE. This way, if something necessitates changing the value again, it only has to be changed in one spot, and additionally we know what the value means when looking through the code.

Currently, the PR fixes this instance of the deadzone value. In the long run, I think it might be best to replace this magic number and all of the instances of 0.2 with a deadzone constant, but I'm not sure where exactly in the Godot code such a constant would go, so that it can be accessed from everywhere it needs to be. If that sounds like a good idea, I would appreciate advice on where to put it 😄

@Meorge Meorge requested a review from a team as a code owner November 12, 2024 17:49
@Mickeon Mickeon added this to the 4.4 milestone Nov 12, 2024
@Meorge Meorge force-pushed the fix-unresponsive-axis-value branch from 311846f to 829dade Compare November 12, 2024 18:12
@Meorge Meorge requested review from a team as code owners November 12, 2024 18:12
@Meorge Meorge changed the title Update InputEventJoypadMotion::set_axis_value to use new default deadzone Replace default deadzone magic number with named constant and fix InputEventJoypadMotion::set_axis_value unresponsiveness Nov 12, 2024
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch 🙂

I didn't know pressed ignored the deadzone until now...

@Repiteo Repiteo merged commit 8fd98b6 into godotengine:master Nov 13, 2024
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Nov 13, 2024

Thanks!

@Meorge Meorge deleted the fix-unresponsive-axis-value branch December 1, 2024 00:54
akien-mga added a commit to akien-mga/godot that referenced this pull request Feb 27, 2025
rddi-8 pushed a commit to rddi-8/godot-custom-features that referenced this pull request Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default deadzone for UI input actions result in unresponsive controller navigation
5 participants