Skip to content

Commit 41e70db

Browse files
committed
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().
1 parent 7d151c8 commit 41e70db

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/input/input.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ void Input::action_press(const StringName &p_action, float p_strength) {
894894
}
895895
action_state.exact = true;
896896
action_state.api_pressed = true;
897-
action_state.api_strength = p_strength;
897+
action_state.api_strength = CLAMP(p_strength, 0.0f, 1.0f);
898898
_update_action_cache(p_action, action_state);
899899
}
900900

0 commit comments

Comments
 (0)