3WQ5QOBGRJNWTTRRNOAEQH6FM6LJGMJ6KYBVC4OZIBBKB6DVCYXAC 43N4PVKE6I5J6DSCYTW2JYOIKLZ7PN7HNLHK4JNT7L23FZDIARSAC F4LRSULH2MZR2DNMBLYBQSSISHNH4SK72YFMYCOA4XKOZYYB4ULAC 3DPJX5VJ4MAWJZDPIQUECTBN47RRKSBAQZKINUJMTRKQ3YPPYNFAC M25YKIY2JP6OEYV2AXC6PBHDU36AFR5ELCRC5HGRPVV4HKK4URLAC KDUAVWRKNFIX4AMHALKW4SHGGB26JJ4BVOL4LVB63V7IADIXNKWQC 7FY3BW7JRAG6T66QQTJEX4F3FPDYPPO2JCR2RAMA65D6HCUIL3YAC let py = actions.axis_pair(&Action::PitchYaw);player.joy += py;if actions.pressed(&Action::Brake) {player.joy = Vec2::ZERO;momentum += (-0.5 * dt * velocity.0);}player.joy.clamp(Vec2::splat(-1.0), Vec2::splat(1.0));if player.joy.length() < 0.1 {player.joy = Vec2::ZERO;}
let mut pya = actions.axis_pair(&Action::PitchYaw);pya.y *= -1.0;let py = pya + joy.0;
use bevy::input::InputPlugin;use bevy::prelude::*;use leafwing_input_manager::plugin::{AccumulatorPlugin, CentralInputStorePlugin};use leafwing_input_manager::prelude::*;use leafwing_input_manager::user_input::testing_utils::FetchUserInput;#[derive(Debug, Resource)]pub struct MouseJoy(pub Vec2);pub fn update_mouse_joy(mut commands: Commands, windows: Query<&Window>) {let window = windows.single();let mut joy = MouseJoy(Vec2::default());if let Some(pos) = window.cursor_position() {joy.0.x = ((pos.x / window.width()) - 0.5) * 2.0;joy.0.y = ((pos.y / window.height()) - 0.5) * 2.0;}commands.insert_resource(joy);}