From 3a7ab8c9acf58449d0e9dfe3c014cbc966f346ed Mon Sep 17 00:00:00 2001 From: yuni Date: Sun, 17 Nov 2024 00:37:40 +0100 Subject: [PATCH] WIP crisper camera controls (fix rotation/accleration with vehicles) --- src/actor.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/actor.rs b/src/actor.rs index be89640..8cf498b 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -588,6 +588,7 @@ pub fn handle_vehicle_enter_exit( commands.entity(driver).remove::(); commands.entity(driver).remove::(); commands.entity(driver).remove::(); + commands.entity(driver).remove::(); commands.entity(driver).insert(JustNowEnteredVehicle); commands .entity(vehicle) @@ -595,6 +596,7 @@ pub fn handle_vehicle_enter_exit( commands.entity(vehicle).remove::(); commands.entity(vehicle).insert(PlayerCamera); commands.entity(vehicle).insert(PlayerDrivesThis); + commands.entity(vehicle).insert(WantsMaxRotation(0.0)); if let Ok(mut flashlight_trans) = q_playerflashlight.get_single_mut() { flashlight_trans.rotation = Quat::from_rotation_y(0f32); flashlight_trans.translation = Vec3::new(0.0, 0.0, 0.0); @@ -614,11 +616,15 @@ pub fn handle_vehicle_enter_exit( Quat::from_rotation_y(180f32.to_radians()); flashlight_trans.translation = Vec3::new(0.0, 0.0, 1.0); } + commands.entity(driver).insert(WantsAcceleration::default()); commands.entity(driver).insert(RigidBody::Dynamic); ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::ExitVehicle)); + commands.entity(vehicle).remove::(); commands.entity(vehicle).remove::(); commands.entity(driver).insert(PlayerCamera); commands.entity(vehicle).remove::(); + commands.entity(vehicle).remove::(); + commands.entity(vehicle).remove::(); *vehicle_vis = Visibility::Visible; } }