From 04f7c3284770a1862c8e270e40f9d2416d055ce1 Mon Sep 17 00:00:00 2001 From: hondres Date: Mon, 15 Feb 2016 22:26:20 +0100 Subject: [PATCH] fix joystick axis handling for Input.is_action_pressed() --- main/input_default.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/main/input_default.cpp b/main/input_default.cpp index 3c81bcef4f..3af02b2b1f 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -102,6 +102,18 @@ bool InputDefault::is_action_pressed(const StringName& p_action) { if (joy_buttons_pressed.has(c)) return true; } break; + case InputEvent::JOYSTICK_MOTION: { + + const InputEventJoystickMotion &iejm=E->get().joy_motion; + int c = _combine_device(iejm.axis,device); + if (_joy_axis.has(c)) { + if (iejm.axis_value < 0) { + if (_joy_axis[c] < -0.5f) return true; + } + else + if (_joy_axis[c] > 0.5f) return true; + } + } break; } }