diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp index fe0e2c2524a..cb38eb67b65 100644 --- a/core/os/input_event.cpp +++ b/core/os/input_event.cpp @@ -595,6 +595,11 @@ float InputEventJoypadMotion::get_axis_value() const { return axis_value; } +bool InputEventJoypadMotion::is_pressed() const { + + return Math::abs(axis_value) > 0.5f; +} + bool InputEventJoypadMotion::action_match(const Ref &p_event) const { Ref jm = p_event; diff --git a/core/os/input_event.h b/core/os/input_event.h index b120d4b840b..d1fd7cc90f2 100644 --- a/core/os/input_event.h +++ b/core/os/input_event.h @@ -348,6 +348,7 @@ public: void set_axis_value(float p_value); float get_axis_value() const; + virtual bool is_pressed() const; virtual bool action_match(const Ref &p_event) const; virtual bool is_action_type() const { return true; }