Replace default deadzone magic number with named constant and fix InputEventJoypadMotion::set_axis_value
unresponsiveness
#99135
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 😄