-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
cargo run --example gamepad_input
not getting RightTrigger2
on linux
#5240
Comments
What gamepad are you using? This is probably an upstream bug in gilrs. |
It's an XBox Wireless Controller. Sorry if I've filed this in the wrong place! Does anyone on the bevy team have permissions to transfer the issue over there? (I can file it manually if not) |
(fwiw while we sort out the right place for this issue)-- using: rather than: (the |
Ah! Looks like #5220 but for triggers. This is probably not terribly hardware specific, and is mostly our problem. We should look to see if the same style of fix can be applied. |
On bevy 0.8.1 I have the same issue. With all of the following controllers: The issue is the same in all cases. Left and right stick analog values report correctly but right and left triggers only act as buttons (analog values for RightZ and LeftZ are always 0.0). I am using:
as @bcolloran mentioned. |
For what it's worth, I couldn't reproduce it until I updated my xpadneo driver to the latest version which mostly consists of this product code change I believe. Basically, old version: SteamInput messed up, input in Bevy works. New version: SteamInput works, input in Bevy messed up. |
@Carlrs, I suspect |
From what I've been testing, wired XBox One controller seems to be working fine now in bevy 0.9.1 (haven't tested earlier versions). I did see a few issues in the gilrs repo that are tangentially related and have been fixed by the latest version of gilrs, as used by latest bevy. @RaddHazard: is this also fixed for you? |
@rdelfin Updated quickly and it looks like I have the same problem. Triggers only working as buttons, no analog values. |
I fell into a rabbit hole on this one a little bit... hopefully something in here is useful. TL;DR: My investigation (see "Research" section) leads me to believe that (at least on linux) In reality, I think different gamepad drivers do different things, some map triggers to LeftZ/RightZ. Then gilrs (using SDL To see some more info about what gilrs is doing with your controller: Add to [dependencies]
gilrs = "0.10"
uuid = "1.3" Put in an existing rust file and use gilrs::{Axis, Button, Gilrs};
use uuid::Uuid;
fn output_gamepad(gilrs: NonSend<Gilrs>, mut printed: Local<bool>, mut counter: Local<u8>) {
if !*printed {
// This is *not* the right way to interact with gamepads in bevy, you shouldn't be using gilrs directly.
for (_, gamepad) in gilrs.gamepads() {
println!("uuid: {:?}", Uuid::from_bytes(gamepad.uuid()));
println!("uuid (no '-'): {:?}", Uuid::from_bytes(gamepad.uuid()).to_string().replace("-", ""));
println!("os_name: {:?}", gamepad.os_name());
println!("map_name: {:?}", gamepad.map_name());
println!("mapping_source: {:?}", gamepad.mapping_source());
println!("LeftZ maps to: {:?}", gamepad.axis_code(Axis::LeftZ));
*printed = true;
}
}
*counter = (*counter).wrapping_add(1);
if *counter % 60 == 0 {
for (_, gamepad) in gilrs.gamepads() {
// This is *not* the right way to get theses values in bevy, you shouldn't be using gilrs directly.
println!("LT: {:?}", gamepad.button_data(Button::LeftTrigger).map(|b| b.value()));
println!("LT2: {:?}", gamepad.button_data(Button::LeftTrigger2).map(|b| b.value()));
}
}
} The output for my Microsoft Xbox 360 Wireless Controller on linux:
Searching for the uuid in https://github.com/gabomdq/SDL_GameControllerDB/blob/master/gamecontrollerdb.txt gets me:
Note the "Research"bevy/crates/bevy_gilrs/src/converter.rs Line 36 in 75da2e7
https://gitlab.com/gilrs-project/gilrs/-/blob/b17de7da57485c41595c17990965e1ad7b7a2c56/gilrs/src/mapping/mod.rs#L108 https://gitlab.com/gilrs-project/gilrs/-/blob/7cd001dacfb188405e5e41520912a259367a4703/gilrs-core/src/lib.rs#L304 When compiled on linux: https://gitlab.com/gilrs-project/gilrs/-/blob/7cd001dacfb188405e5e41520912a259367a4703/gilrs-core/src/platform/linux/gamepad.rs#L1117-1120 https://gitlab.com/gilrs-project/gilrs/-/blob/7cd001dacfb188405e5e41520912a259367a4703/gilrs-core/src/platform/linux/gamepad.rs#L1012 https://github.com/torvalds/linux/blob/9f4211bf7f811b653aa6acfb9aea38222436a458/include/uapi/linux/input-event-codes.h#L844 https://www.kernel.org/doc/html/v6.3/input/event-codes.html?highlight=abs_z#ev-abs |
Thank you @geophree! I can confirm |
What went wrong
RightTrigger2
input is not logged when trying thecargo run --example gamepad_input
example on linux. Gampad verified to be working (all axes, triggers, buttons) via https://greggman.github.io/html5-gamepad-test/Bevy version
(just pulled
latest
)Relevant system information
System
cargo:
What you did
Ran
cargo run --example gamepad_input
, and tried pressing all the buttons and wiggling the sticks on the gamepad.Here are the first several lines of output when I run the example
The text was updated successfully, but these errors were encountered: