Add support for joypad echo events#117782
Conversation
a866bc5 to
afe75f5
Compare
I would just reuse the same deadzone as the regular action. If you hold an axis at a position where the input would be sent, it should also echo eventually. |
But the thing is, |
b182fcf to
bbf41e6
Compare
This PR adds the code in `Input` class to send joypad echo events if they are enabled in the project settings.
There was a problem hiding this comment.
Tested locally, it mostly works as expected.
Some feedback:
-
Echo events don't work for focus navigation, or Tree/ItemList navigation. I would expect echo events to be followed in both cases to match other games/engines.
- In contrast, it works with keyboard-based navigation (try holding down Tab).
-
The repeat timer should ignore
Engine.time_scale, as currently, using a higher time scale will speed up the rate at which echo events are sent (as well as reduce the initial delay before the first echo event). You can test this by using--time-scale 5in the Main Run Args project setting.
|
Although now that I think about it, should we really have axis echo events? I mean, they have to share the same deadzone for all actions, otherwise we have to introduce a different type of echo events (most likely |
This PR adds the code in
Inputclass to send joypad echo events for both buttons and axes.This PR adds 5 new project settings:
input_devices/joypads/joypad_echo_events/send: Iftrue, the engine will send joypad echo events after the user has pressed the joypad buttons or moved the joypad axes for long enough,falseby default for existing projects andtrueby default for newly created projects;input_devices/joypads/joypad_echo_events/wait_time: The amount of time of pressing the joypad buttons or keeping the joypad axes over the deadzone required for the engine to start sending echo events, in seconds,0.5by default;input_devices/joypads/joypad_echo_events/count_per_second: The number of times per second joypad echo events should be sent by the engine after the user has pressed the buttons or kept the axes over the deadzone for long enough,20by default;input_devices/joypads/joypad_echo_events/axis_echo_events/send: Iftrue, the engine will send joypad echo events for axes movement after the user has moved the joypad axes for long enough,trueby default (it has no effect ifinput_devices/joypads/joypad_echo_events/sendis set tofalse);input_devices/joypads/joypad_echo_events/axis_echo_events/deadzone: The deadzone that is used by the engine to determine if joypad axes echo events should be sent,0.5by default.Echo events for joypad buttons:
2026-04-14.22-17-37.mp4
This PR also works with high numbers of echo events per second that are set via
input_devices/joypads/joypad_echo_events/count_per_second. Here I set it to1000, you can see that the counter increases by 1000 every second:2026-04-14.22-18-08.mp4
Echo events for joypad axes:
2026-04-25.15-22-57.mp4
I'm currently not entirely sure how to add echo events for axes in a way that makes sense, butI was also thinking of creating another project setting that would be a deadzone for echo events. If the axis value is higher than the deadzone, the echo events will be sent. (EDIT: I think this approach is good enough, so it's now used in this PR!)TODO:
InputEventJoypadButton.is_echo()+ProjectSettings.input_devices/joypads/send_joypad_echo_eventsProjectSettings.input_devices/joypads/joypad_echo_events_wait_timeProjectSettings.input_devices/joypads/joypad_echo_events_count_per_secondInput::_process()in the main/rendering step instead of the physics stepProjectSettings.input_devices/joypads/send_joypad_echo_eventsby default for new projects?