godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.15k stars 21.19k forks source link

2 active directions when controller D-Pad quickly changes direction #42200

Open ImAReplicant opened 4 years ago

ImAReplicant commented 4 years ago

Godot version:

Godot 3.2.3 and 3.2.2

OS/device including version:

Arch Linux

Issue description:

Change quickly the direction on D-Pad of gamepad doesn't released the first direction. Tested with Xbox Controller, Dualshock 4 and Nintendo Switch Controller

Steps to reproduce: Download the "Joypads Demo / Tools" and quickly switch from left to right or top to bottom for example, both directions remain pressed : gamepad

quinnyo commented 4 years ago

I just tried this with a PS4 controller but couldn't replicate it. Maybe I just can't switch directions as fast as I used to... I thought it might be worth mentioning that I have had some pretty surprising behaviour with controllers before, when Steam is running. Something to do with the steam input customisation fighting the system input drivers, perhaps.

(on a reasonably up to date Arch Linux, Godot 3.2.3, bluetooth controller)

ImAReplicant commented 4 years ago

Yeah on a PS4 controller it's harder to reproduce but after several tries the bug appears anyway. On a switch pro controller or xbox 360 controller, it's much easier, probably due to the design of the D-Pad :

ps4 switch

For Steam I don't know if it's the problem but I have the same bug with or without Steam open.

Calinou commented 4 years ago

I can't reproduce this on Godot 3.2.3 (Fedora 31, Xbox One V3 controller in wired mode).

ImAReplicant commented 4 years ago

I tested on Windows with Xbox 360 and PS4 controllers and I can't reproduce the bug. I could not test with the Nintendo Switch controller because there is no Windows driver.

So I'm lost, it would be a problem with Linux drivers ?

Calinou commented 4 years ago

I wonder if the bug is due to input accumulation…

@ImAReplicant Try calling Input.set_use_accumulated_input(false) in the _ready() function of any script of the Joypads demo and see if the situation improves.

ImAReplicant commented 4 years ago

Always the same bug after the modification.

quinnyo commented 4 years ago

I'm not sure how Godot reads/receives gamepad input but AFAIK, via evdev or /dev/input/js*, a D-Pad (hat switch) cannot report opposite directions simultaneously. There's 2 values, for X & Y, essentially a 2 axis joystick. You can run test utilities like evtest or jstest to see this.

Calinou commented 4 years ago

It might be worth testing with udev as well. By default, Godot is built without udev support as its presence isn't guaranteed on all Linux distributions. If you can compile Godot from source, install udev development libraries then pass the udev=yes SCons option when building the editor. Once this is done, run the Joypads demo with the freshly compiled editor binary (which is in bin/).

(Make sure to compile the 3.2.3-stable tag for better reproducibility by running git checkout 3.2.3-stable in the cloned repository.)

ImAReplicant commented 4 years ago

@quinnyo Indeed I tested with the 2 utilities and the D-pad is recognized as an axis (ABS_HAT0X and ABS_HAT0Y)

@Calinou Okay, I'll try that.

Edit : I still have the same problem with godot built with udev

Hex4F commented 3 years ago

I get this same problem on Ubuntu 20.10 with the Godot 3.2.3 binary release. I'm using an Xbox 360 controller and don't have Steam installed. It happens frequently enough to make challenging segments unplayable with the D-pad.

Notably, this never happened when I used Godot on Windows 7 with the exact same hardware.

akien-mga commented 3 years ago

By default, Godot is built without udev support as its presence isn't guaranteed on all Linux distributions.

FYI, official Godot binaries have always been built with udev enabled. Custom builds weren't until a few months ago.

mrbobs commented 2 years ago

Hi, I may have run in to the same issue as the one described, is there a fix or workaround for this issue?

Rindbee commented 2 months ago

It may happen on specific controllers, similar to #66878.

If it is convenient, you can use evtest/evemu-record to test the keycode mapping of the controller on Linux.