Xbox Wireless Controller over bluetooth axis mixed up
Tested versions
- Reproducable in v4.1, v4.2, 4.3-dev
System information
Godot v4.2.1.stable.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated AMD Radeon RX 6700 XT (Advanced Micro Devices, Inc.; 31.0.14043.7000) - AMD Ryzen 9 3900X 12-Core Processor (24 Threads)
Issue description
I have two Xbox Wireless Controllers (Model 1704, Xbox One S Controller) connected via bluetooth to my PC.
Because I had issues with the controllers introducing stutters in God of War (PC) I connected them via USB and updated the firmware via the Xbox Accessories app from v3.x to v5.17.3202.0.
The update removed the stuttering in GoW but unfortunately some games (Hammerwatch series for example) and also Godot now mix up some axis and buttons when Godot editor / game is focused.
The mixed up axis are:
- Move right stick left:
Joypad Axis 1 - (Left Stick Up, Joystick 0 up) - Move right stick up:
Joypad Axis 4 - (Joystick 2 Left) - Move right stick right:
Joypad Axis 3 + (Right Stick Down, Joystick 1 Down) - Move right stick down:
Joypad Axis 4 + (Left Trigger, Sony L2, Xbox LT, Joystick 2 Right) - Press left trigger:
Joypad Axis 2 + (Right Stick Right, Joystick 1 Right) - Press right trigger:
Joypad Axis 2 - (Right Stick Left, Joystick 1 Left)
The mixed up buttons are:
- Press left shoulder:
Joypad Button 4 (Back, Sony Select, Xbox Back, Nintento -) - Press right shoulder:
Joypad Button 5 (Guide, Sony PS, Xbox Home) - Press select:
Joypad Button 6 (Start, Xbox Menu, Nintendo +) - Press start:
Joypad Button 7 (Left Stick, Sony L3, Xbox L/LS) - Press left stick:
Joypad Button 8 (Right Stick, Sony R3, Xbox R/RS) - Press right stick:
Joypad Button 9 (Left Shoulder, Sony L1, Xbox LB)
All other axis / buttons work fine. When connecting the controllers via USB cable, everything is fine. When Godot editor / game is unfocused, everything is fine (this is really strange to me).
The controllers are listed as Bluetooth LE XINPUT-compatible input device (VID: 045E, PID: 0B20) when connected over bluetooth and as XINPUT-compatible HID-device (VID: 045E, PID: 02FF) when connected via cable.
I've also tried to add the controllers to the list of known xinput devices in joypad_windows.cpp - JoypadWindows::is_xinput_device but the GUID changes everytime the game / editor process is restarted.
I've added a manual check for only PID and VID so xinput is forced but then no inputs are recognized at all which confused me because in theory, those devices should be used via xinput instead of dinput.
I'm a bit lost here now but maybe there is something wrong with mapping inputs to the axis / buttons somewhere?
Steps to reproduce
- Have an Xbox Wireless Controller
- Connect via USB to PC
- Open Xbox Accessories app
- Click on "three dots" button
- Update firmware to v5.17+
- Disconnect USB cable
- Reconnect via bluetooth
- Open any Godot project (v4.1+ but might be lower versions as well, not tested)
- Open project settings
- Click input tab
- Add new input binding
- Try to configure input actions for right stick / triggers / buttons listed above
- See that they are all mixed up
- Click outside of Godot window, i.e. Desktop
- Press the same inputs again and see that they're recognized correctly
Minimal reproduction project (MRP)
Can you reproduce this in Godot 3.5.3?
Yes, I can reproduce this in Godot 3.5.3 as well. It's a little different but still everything mixed up - but it's also mixed up when connect via USB cable in 3.5.3 (which fixes the issue on Godot 4).
I've attached a small reproduction project which displays an Xbox controller and hightlights the buttons axis when pressed / moved.
You can see here, for example, that when I press the right trigger the right stick is also interpretet as "moved to left".
I could also observe that when simply logging the events from _Input that two inputs are sent, one correctly and one wrong (the mixed up one, seems to "win" every time because it's triggered later than the correct one).
Getting this issue as well on MacOS 14.1.1 with Godot 4.2.1
so far only noticed that Godot is recognizing reversed triggers: Press left trigger -> Joypad Axis 5 (should be Axis 4) Press right trigger -> Joypad Axis 4 (should be Axis 5)
Other applications on MacOS as well as https://hardwaretester.com/gamepad all recognize the inputs correctly.
I have also noticed this mapping issue on macOS 14.1 and Godot 4.2 with an Xbox Series X gamepad. I've never tried a gamepad with the engine before though, and as far as I know my gamepad has never been updated, so I cannot say when or why the issue appeared.
Here are all the problematic mappings (and what they should be):
Left Trigger - Joypad Axis 5 (Axis 4) Right Trigger - Joypad Axis 4 (Axis 5) Left Bumper - Joypad Button 6 (Button 9) Right Bumper - Joypad Button 7 (Button 10)
X - Joypad Button 3 (Button 2) Y - Joypad Button 4 (Button 3)
Select - Joypad Button 10 (Button 4) Home - Joypad Button 12 (Button 5) Start - Joypad Button 11 (Button 6)
Could anyone reproducing the issue test https://github.com/godotengine/godot/pull/80709 locally to see if it resolves the issue?
Tried with latest master branch but still the same issue with the mixed up axis and buttons - but, strangely, only when the app is focused.
Here you can see what's happening when the application is unfocused: https://github.com/godotengine/godot/assets/3224400/4001859c-27aa-4306-938e-d1d50bfab2a6
And this is with focused window: https://github.com/godotengine/godot/assets/3224400/24636bc2-cf08-4c02-8113-517cef974ce0
Unfortunately I've covered the DPad in the second clip but this one is working fine so I left it as is
Are there any ongoing efforts to fix this?
As reliable input support for input is non existent as long as this problem exists. Having very similar problems as the creator of this issue on Mint, latest Kernel. Works fine everywhere except for Godot. tested on 4.2.0 stable, 4.2.1 stable, 4.3 dev.
Using generic ps4 and xbox gamepad via USB. Just the mapping is mixed up.
Working on a c# workaround already but that could take a few days.
https://github.com/godotengine/godot/pull/87925 likely fixes this issue on Linux. Can you test that PR locally?
@Calinou tested, did not work.
Ok, so what I did for my Godot Cutulu Library is that I do not map the inputs by name like LeftY, RightX, but instead index them all, meaning JoyButton, JoyAxis, Key, all that stuff into one single enum and work with the int value ranges of those enums. Then I map them to a custom written inputmap class.
It's not an easy workaround but it works quite well and is nice to work with.
I'm using Godot Engine 4.2.1 (stable) on Ubuntu Computer Microsoft Surface Pro 6
Controller: Microsoft Controller (STANDARD GAMEPAD Vendor: 045e Product: 0b12)
Same problems as the initial post except:
- Move right stick left: Joypad Axis 3 - (Right Stick Up, Joystick 1 up)
I noticed that the confusion seems to be related to the different order of enumerations in input-event-codes.h and JoyButton:
BTN_THUMBLandBTN_THUMBRininput-event-codes.hLEFT_STICKandRIGHT_STICKin the correspondingJoyButton
https://github.com/torvalds/linux/blob/d74da846046aeec9333e802f5918bd3261fb5509/include/uapi/linux/input-event-codes.h#L380-L399
https://github.com/godotengine/godot/blob/a7a124a57d643103c882a781dfe1f3772363ecc7/core/input/input_enums.h#L62-L87
Some input devices or input modes support some additional button events even though there are no corresponding keys, such as BTN_C and BTN_Z. This also affect the mapping order.
https://github.com/godotengine/godot/blob/a7a124a57d643103c882a781dfe1f3772363ecc7/platform/linuxbsd/joypad_linux.cpp#L307-L311
These will result in incorrect mapping.
Anyone can use evtest to test his or her own device.
The devices that have the mapping problem might be one that is not documented in the file core/input/gamecontrollerdb.txt.
We may be able to provide a fallback method for devices not in this file, so that the keys can be mapped semantically to simply support newer devices. See Linux Gamepad Specification
I had this same issue with an 8bitDo Ultimate 2C Controller as well as an 8bitDo Lite 2 controller on Windows 10 with Godot 4.3, I checked the SDL controller database list to see if they were listed there and they are listed there. However, they both had alternate wrong mappings when connected via bluetooth versus wireless. Godot also labeled my Ultimate Controller as two different controllers, it registered it as a "6 axis 16 button gamepad with hat switch" when connected to bluetooth and as a "XInput Gamepad" when connected via wireless receiver.
I tested a little more on a separate new project and the problem still continued. The button mismatches were the same as the others above, but the problem seems to rest on the fact that when the controller is connected via Bluetooth, the two triggers are read as buttons instead of axes, so that screws up Godot as it's reading the controller?
Just wondering if this issue is still being worked on?
Windows Version: 10 Enterprise 1809 Godot Version: 4.3
Same issue with 8bitdo ultimate 2c as above comment but on fedora linux 40
This issue is still happening Xbox ONE bluetooth controller
move right joystick up = joystick left move right joystick down = joystick right move right joystick left = joystick up move right joystick right = joystick down
is there a workaround for this?
Still happening on latest v4.4 beta. However, my hopes are up for this proposal: https://github.com/godotengine/godot-proposals/issues/9000 - I think this would solve all issus.
I was wondering why it works with Unrailed 2 which also has been built using the Godot engine but I found the SDL3 library in the files so it looks like they use a custom input solution.
Same problem as sarahyack but using an 8BitDo Ultimate 2.4G Controller.
Godot v4.4.rc.mono - Windows 11 (build 26100)
For Linux, there is already this issue:
- https://github.com/godotengine/godot/issues/65308
Hello! May I ask if the issue is still reproducible in Godot 4.5?
the issue has been fixed for me since 4.5