mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-12 18:38:43 -06:00
fix stick input
This commit is contained in:
parent
acbb159606
commit
3af40c28b8
|
@ -99,12 +99,8 @@ fn update_input_state_gamepad (
|
||||||
mut inputs: UniqueViewMut<Inputs>,
|
mut inputs: UniqueViewMut<Inputs>,
|
||||||
) {
|
) {
|
||||||
if let Some(Some(gamepad)) = active_gamepad.0.map(|id| gilrs.0.connected_gamepad(id)) {
|
if let Some(Some(gamepad)) = active_gamepad.0.map(|id| gilrs.0.connected_gamepad(id)) {
|
||||||
let lx = gamepad.axis_data(Axis::LeftStickX).map(|x| x.value()).unwrap_or_default();
|
let left_stick = vec2(gamepad.value(Axis::LeftStickX), gamepad.value(Axis::LeftStickY));
|
||||||
let ly = gamepad.axis_data(Axis::LeftStickY).map(|y| y.value()).unwrap_or_default();
|
let right_stick = vec2(gamepad.value(Axis::RightStickX), gamepad.value(Axis::RightStickY));
|
||||||
let rx = gamepad.axis_data(Axis::RightStickX).map(|x| x.value()).unwrap_or_default();
|
|
||||||
let ry = gamepad.axis_data(Axis::RightStickY).map(|y| y.value()).unwrap_or_default();
|
|
||||||
let left_stick = vec2(lx, ly);
|
|
||||||
let right_stick = vec2(rx, ry);
|
|
||||||
inputs.movement += left_stick;
|
inputs.movement += left_stick;
|
||||||
inputs.look += right_stick;
|
inputs.look += right_stick;
|
||||||
inputs.action_a |= gamepad.is_pressed(Button::South);
|
inputs.action_a |= gamepad.is_pressed(Button::South);
|
||||||
|
|
Loading…
Reference in a new issue