Allow to specify a custom strength when calling Input.action_press(), this allows virtual axis, mainly for mobile.

This commit is contained in:
Davide Baldo 2018-11-09 21:32:32 +00:00
parent a16d9c6ab6
commit 1b0c7515ff
5 changed files with 8 additions and 6 deletions

View file

@ -556,14 +556,14 @@ Point2i InputDefault::warp_mouse_motion(const Ref<InputEventMouseMotion> &p_moti
void InputDefault::iteration(float p_step) {
}
void InputDefault::action_press(const StringName &p_action) {
void InputDefault::action_press(const StringName &p_action, float p_strength) {
Action action;
action.physics_frame = Engine::get_singleton()->get_physics_frames();
action.idle_frame = Engine::get_singleton()->get_idle_frames();
action.pressed = true;
action.strength = 0.f;
action.strength = p_strength;
action_state[p_action] = action;
}