mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
fix joystick axis handling for Input.is_action_pressed()
This commit is contained in:
parent
3065187300
commit
04f7c32847
1 changed files with 12 additions and 0 deletions
|
@ -102,6 +102,18 @@ bool InputDefault::is_action_pressed(const StringName& p_action) {
|
||||||
if (joy_buttons_pressed.has(c))
|
if (joy_buttons_pressed.has(c))
|
||||||
return true;
|
return true;
|
||||||
} break;
|
} 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue