How do HSlider and VSlider send controller echo events?

Godot Version

4.3

Question

Hey There! I’m in the process of generating my own echo events for controller input, because my understanding is that Godot does not do this by default. However in doing this I discovered that HSlider and VSlider both send echo events on their own when I hold down the control stick or DPad. How is this being done? Can I replicate this behavior for my universal controller or will this cause issues when I build my own echo event generator? Thanks for your insight, this is a puzzling one.

You can check the code, Godot is open source :wink:

It does it internally keeping its own timer. It first checks if the input event is a gamepad one:

If it is and it wasn’t just pressed then it enables its internal process:

And then it change the value keeping track of its own internal timer:

Here’s the constants it’s using:

1 Like