godot: InputEventJoypadMotion will trigger multiples on_value_changed with hslider

Godot version

3.4.4 (and 3.3.4, 3.5-rc6)

System information

Windows 10

Issue description

Hi all, If you map ui_left and ui_left with the left joystick of a controller (xbox one in this case), when using a hslider, the on changed value event will be trigged multiples times.

image

e.g. a hslider with a step of 5%, with the stick, the value increase randomly from 10% to 20%, while using the direction cross will only trigger a 5% step.

https://user-images.githubusercontent.com/1162446/178392471-b41b5954-1482-45d8-adf1-8ad2027e1635.mp4

I think InputEventJoypadMotion should only be trigger once to match industry standard.

If this isn’t a duplicate, I would be interested to take a look and create a PR if this is a good “first issue”.

Thanks

Steps to reproduce

1 - Create a minimal project with a hslider 2 - Remap ui_left, ui_right to the left joystick image 3 - Create a hslider 4 - Change the value with the joystick

Minimal reproduction project

hslider_issue.zip

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (13 by maintainers)

Most upvoted comments

I understand that “Gamepads never send echo inputs, so is_echo() would be invalid” -> my point is that as a gamedev I need an is_echo() function (or equivalent) for gamepads in order to detect repeated input signals in certain situations (mainly UI). I can reproduce it with a timer in GDscript (blocking input repetition happening within a given short time frame) but it is tedious and ridiculous to reproduce for every game UI. Currently porting an interface game to Switch, I realize how important this is and if Godot is to be used for console games, where all navigation happens with the stick, this issue is a real problem.

I tried and add the same behavior to every node (slider, popup menu, item list, tree etc) but it seems more like a workaround (it is also my first PR so my lack of experience in c++ and Godot source code could be the real issue).

Even if a gamepad doesn’t have an echo, could we implement a behavior inside Input to re-trigger an event. maybe for an UI exclusive mode?

Or we could list witch component to prioritize like the slider and popup menu and add the echoing

Hello, it would be great to have an is_echo() function for gamepads, which would avoid this issue.

Gamepads never send echo inputs, so is_echo() would be invalid. Only keyboards send echo events as determined by the operating system configuration.

Instead, we should look into properly handling analog stick UI inputs out of the box (D-pad input should also send those echo events for consistency). This is entirely feasible, but requires manually implementing echo inputs in certain UI nodes (such as Slider and SpinBox).