bevyengine / bevyengine/bevy

Document how to configure gamepads

Open
#3,246 11 comments 0 reactions 0 assignees View on GitHub
A-Input C-Docs D-Trivial S-Ready-For-Implementation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## How can Bevy's documentation be improved?

[`GamepadInputSettings`](https://docs.rs/bevy/0.5.0/bevy/input/gamepad/struct.GamepadSettings.html) is somewhat challenging to figure out how to use. A simple example system would go a long way.

```rs
fn configure_gamepad(mut settings: ResMut, gamepads: Res) {
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;
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.