fix flicker when toggling 3rd person camera

This commit is contained in:
yuni 2024-03-30 18:56:24 +01:00
parent 3472be43b0
commit 15781d2175
2 changed files with 2 additions and 2 deletions

View file

@ -309,6 +309,7 @@ pub fn handle_vehicle_enter_exit(
if event.is_entering {
// Entering Vehicle
commands.entity(driver).remove::<RigidBody>();
*driver_vis = Visibility::Hidden; //seems to have no effect...
if event.is_player {
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::EnterVehicle));
commands.entity(driver).remove::<PlayerCamera>();

View file

@ -14,7 +14,7 @@ impl Plugin for CameraControllerPlugin {
fn build(&self, app: &mut App) {
app.add_systems(Startup, setup_camera);
app.add_systems(Update, handle_input);
app.add_systems(Update, manage_player_actor);
app.add_systems(Update, manage_player_actor.after(handle_input));
app.add_systems(PostUpdate, sync_camera_to_player
.after(PhysicsSet::Sync)
.before(TransformSystem::TransformPropagate));
@ -93,7 +93,6 @@ pub fn handle_input(
}
fn manage_player_actor(
mut commands: Commands,
settings: Res<settings::Settings>,
mut q_playercam: Query<&mut Visibility, With<actor::PlayerCamera>>,
mut q_hiddenplayer: Query<&mut Visibility, (With<actor::Player>, Without<actor::PlayerCamera>)>,