This is Godot 4 and, as dumb as it looks, this is the code:
func _input(event):
print(event, " in device ", event.device)
When playing in debug mode, I see many events like this:
InputEventJoypadMotion: axis=1, axis_value=-0.35 in device 0
InputEventJoypadMotion: axis=0, axis_value=-0.01 in device 0
InputEventJoypadMotion: axis=1, axis_value=-0.35 in device 0
InputEventJoypadMotion: axis=0, axis_value=-0.01 in device 0
InputEventJoypadMotion: axis=1, axis_value=-0.34 in device 0
InputEventJoypadMotion: axis=0, axis_value=-0.01 in device 0
InputEventJoypadMotion: axis=1, axis_value=-0.34 in device 0
InputEventJoypadButton: button_index=0, pressed=false, pressure=0.00 in device 0
InputEventJoypadButton: button_index=3, pressed=true, pressure=0.00 in device 0
InputEventJoypadMotion: axis=0, axis_value=-0.01 in device 0
InputEventJoypadMotion: axis=1, axis_value=-0.34 in device 0
InputEventJoypadMotion: axis=0, axis_value=-0.01 in device 0
InputEventJoypadMotion: axis=1, axis_value=-0.34 in device 0
InputEventJoypadMotion: axis=0, axis_value=-0.02 in device 0
InputEventJoypadMotion: axis=1, axis_value=-0.34 in device 0
InputEventJoypadMotion: axis=0, axis_value=-0.02 in device 0
InputEventJoypadMotion: axis=1, axis_value=-0.34 in device 0
InputEventJoypadMotion: axis=1, axis_value=-0.34 in device 0
InputEventJoypadMotion: axis=0, axis_value=-0.02 in device 0
InputEventJoypadMotion: axis=1, axis_value=-0.34 in device 0
InputEventJoypadMotion: axis=1, axis_value=-0.34 in device 0
InputEventJoypadMotion: axis=0, axis_value=-0.02 in device 0
InputEventJoypadMotion: axis=1, axis_value=-0.33 in device 0
InputEventJoypadMotion: axis=0, axis_value=-0.02 in device 0
InputEventJoypadMotion: axis=1, axis_value=-0.33 in device 0
InputEventJoypadMotion: axis=0, axis_value=-0.02 in device 0
InputEventJoypadMotion: axis=1, axis_value=-0.33 in device 0
InputEventJoypadMotion: axis=0, axis_value=-0.02 in device 0
(i.e. moving, moving, moving, slightly pressing the touchpad, moving, moving, moving...)
How do I prevent the touchpad from being recognized as a joypad / gamepad / etc? When I connect joypads (even a virtual one I'm developing), The result of this function:
Input.get_connected_joypads()
Is [0, some_id]
where 0
stands for the touchpad and the other id corresponds to a physical joypad or a virtual pad.
In fact, I expect InputEventMouseMotion
or InputEventMouseButton
to be triggered from the touchpad. NOT my touchpad being recognized as a joypad in the game.
Any hint on this? I'd like to either:
- Fix whatever is causing my touchpad, in godot, to be recognized as a joypad instead. This is wrong to me, at least. Please: Do not suggest me about removing the 0. I'm not sure how stable doing that results.
- From
Input.get_connected_joypads()
, filter which devices do not belong to actual joypads (physical or virtual) and only keep the joypads.