Fix action_press() by clamping strength to 0, 1

Changed Input.action_press() treatment of strength parameter to match
behavior of InputEventAction and documentation, by clamping between 0
and 1. Fixes Input.get_action_strength() returning values over 1 when
large values are passed to Input.action_press().
This commit is contained in:
Mark Wilson 2024-03-27 11:17:40 -04:00
parent 7d151c8381
commit 41e70db8b1
1 changed files with 1 additions and 1 deletions

View File

@ -894,7 +894,7 @@ void Input::action_press(const StringName &p_action, float p_strength) {
}
action_state.exact = true;
action_state.api_pressed = true;
action_state.api_strength = p_strength;
action_state.api_strength = CLAMP(p_strength, 0.0f, 1.0f);
_update_action_cache(p_action, action_state);
}