Skip to content

Commit

Permalink
Fix action_press() by clamping strength to 0, 1
Browse files Browse the repository at this point in the history
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().
  • Loading branch information
wlsnmrk committed Mar 27, 2024
1 parent 7d151c8 commit 41e70db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/input/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 41e70db

Please sign in to comment.