Description
Tested versions
Reproducible in v4.1.1.stable.mono.official [bd6af8e], v4.2.1.stable.mono.official [b09f793], v4.3.dev.mono.custom_build [7d151c8]
System information
Godot v4.2.1.stable.mono - Windows 10.0.22631
Issue description
Input.action_press()
should only accept values for its strength
parameter between 0 and 1, and likewise Input.get_action_strength()
should only return values between 0 and 1. The analogous InputEventAction.strength
property is correctly clamped between 0 and 1, and cannot be set outside that range.
However, Input.action_press()
does not bounds-check the strength parameter, and if passed a value greater than 1, sets the action state to an out-of-bounds value, causing Input.get_action_strength()
to return the same out-of-bounds value. In v4.1, values less than 0 are also accepted into action state.
Illustrative screenshot of the MRP (running in v4.2), which shows the correct behavior of the InputEventAction.strength
property as well as the bug in Input.action_press()
:
Steps to reproduce
See attached MRP, or do:
Input.action_press("test_action", 2.0)
print(str(Input.get_action_strength("test_action"))
For v4.1, Input.action_press("test_action", -1.0)
will also produce incorrect output.