-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Document how to configure gamepads #3246
Copy link
Copy link
Open
Labels
A-InputPlayer input via keyboard, mouse, gamepad, and morePlayer input via keyboard, mouse, gamepad, and moreC-DocsAn addition or correction to our documentationAn addition or correction to our documentationD-TrivialNice and easy! A great choice to get started with BevyNice and easy! A great choice to get started with BevyS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!
Description
How can Bevy's documentation be improved?
GamepadInputSettings is somewhat challenging to figure out how to use. A simple example system would go a long way.
fn configure_gamepad(mut settings: ResMut<GamepadSettings>, gamepads: Res<Gamepads>) {
if !settings.is_changed() | gamepads.is_changed() {
return;
}
const DEADZONE: f32 = 0.1;
// The joystick should not register inputs when near the center
for &gamepad in gamepad_lobby.iter() {
let left_stick_x = GamepadAxis(gamepad, GamepadAxisType::LeftStickX);
let left_stick_y = GamepadAxis(gamepad, GamepadAxisType::LeftStickY);
let mut left_x_settings = settings.axis_settings.get_mut(&left_stick_x).unwrap();
left_x_settings.threshold = DEADZONE;
let mut left_y_settings = settings.axis_settings.get_mut(&left_stick_y).unwrap();
left_y_settings.threshold = DEADZONE;
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-InputPlayer input via keyboard, mouse, gamepad, and morePlayer input via keyboard, mouse, gamepad, and moreC-DocsAn addition or correction to our documentationAn addition or correction to our documentationD-TrivialNice and easy! A great choice to get started with BevyNice and easy! A great choice to get started with BevyS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!