-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Controller Triggers stay pressed on Android #79263
Comments
Which controller model are you using on desktop and Android? Is it the same controller model on both platforms? |
I've tested it using both an XBox Series controller, and the 8BitDo Pro 2. The staying-pressed issue persists with both controllers, however it seems only the XBox controller has the Inverted Triggers problem (LT being RT, and RT being LT). |
Note that the swapped triggers issue on an Xbox controller was already reported in #56181. |
Thanks. I updated the post. |
I've observed this bug on Android using an Xbox One X Bluetooth controller. The game in question was built with Godot 3.5. I'd be interested in tackling this but I'm not sure where to start. I was looking around here but I couldn't discern if the triggers are being treated differently from the other buttons in some way. |
I wrote a minimal sample project to supplement the original one that displays the numerical joystick axis value for the R2 trigger. On PC it goes from 0 to 1 as expected. On Android, after the initial event trigger, it stays stuck at 0.5 with both a continuous read in Edit: The action event works as expected when the threshold value is changed, so if we up it to 0.65 for example, it will work as expected. It just seems like the numerical value is messed up on Android. |
Found the culprit! The platform-agnostic input handler is indiscriminately adding 0.5 to the analog triggers: https://github.com/godotengine/godot/blob/75de1ca76871fdf7f5a9e081aa57ec0e33061107/core/input/input.cpp#L1120C7-L1120C7 Android's motion event for L2 and R2 already have a range from 0 to 1, so this conversion is not necessary on Android and ends up breaking the value. https://developer.android.com/reference/android/view/MotionEvent#AXIS_RTRIGGER
|
In the meantime, I was able to workaround this bug by changing the threshold value in the input map to something higher than 0.5 (I settled on 0.7 for my title). |
`Input::joy_axis` converts trigger values to be between 0.0f to 1.0f by default. This is not needed for Android, as values are already within that range, as per Android documentation: https://developer.android.com/reference/android/view/MotionEvent#AXIS_RTRIGGER This patch prevents this conversion on Android, which caused L2 and R2 triggers to get stuck pressed. godotengine#79263
`Input::joy_axis` converts trigger values to be between 0.0f to 1.0f by default. This is not needed for Android, as values are already within that range, as per Android documentation: https://developer.android.com/reference/android/view/MotionEvent#AXIS_RTRIGGER This patch prevents this conversion on Android, which caused L2 and R2 triggers to get stuck pressed. godotengine#79263
`Input::joy_axis` converts trigger values to be between 0.0f to 1.0f by default. This is not needed for Android, as values are already within that range, as per Android documentation: https://developer.android.com/reference/android/view/MotionEvent#AXIS_RTRIGGER This patch prevents this conversion on Android, which caused L2 and R2 triggers to get stuck pressed. godotengine#79263 (cherry picked from commit d413a02)
I'm using Godot 4.3 and this issue seems to still exist. The triggers rest at 0.5 and go to 1.0 when pressed. |
Godot version
4.1.stable
System information
Android 12, OneUI 4.1, Galaxy S10e | Godot 4.1.stable
Issue description
Description
On Android, Controller Triggers once pressed, stay pressed until the game is restarted
Video:
On Windows - everything works as intended.
https://github.com/godotengine/godot/assets/78328941/ee7976ab-b35a-4f91-888b-f3774c42e1b0
On Android - Once a Trigger is pressed, it stays pressed (Inverted triggers is a separate issue).
https://github.com/godotengine/godot/assets/78328941/981b514a-1c17-4490-9313-f72d89dec4d4
The Setup
Input Map
Scene
Code
Steps to reproduce
Minimal reproduction project
controller trigger test.zip
The text was updated successfully, but these errors were encountered: