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.action_press() accepts and sets action state to out-of-bounds strength values #89945

Closed
wlsnmrk opened this issue Mar 27, 2024 · 0 comments · Fixed by #89946
Closed

Input.action_press() accepts and sets action state to out-of-bounds strength values #89945

wlsnmrk opened this issue Mar 27, 2024 · 0 comments · Fixed by #89946

Comments

@wlsnmrk
Copy link
Contributor

wlsnmrk commented Mar 27, 2024

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():
Screenshot 2024-03-27 114746

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.

Minimal reproduction project (MRP)

ActionPressStrengthMRP.zip

@wlsnmrk wlsnmrk changed the title Input.action_press() accepts and sets action state to out-of-range strength values Input.action_press() accepts and sets action state to out-of-bounds strength values Mar 27, 2024
@AThousandShips AThousandShips added this to the 4.3 milestone Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants