From 26b974ea16aed1e206fc0688b4f6422fab910676 Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 30 Mar 2024 18:50:53 +0100 Subject: [PATCH] better camera jitter avoidance as described here: https://docs.rs/bevy_xpbd_3d/latest/bevy_xpbd_3d/index.html#why-does-my-camera-following-jitter --- src/camera.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/camera.rs b/src/camera.rs index d92f4dc..0a659b7 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -3,8 +3,8 @@ use bevy::input::mouse::MouseMotion; use bevy::window::PrimaryWindow; use bevy::core_pipeline::bloom::{BloomCompositeMode, BloomSettings}; use bevy::core_pipeline::tonemapping::Tonemapping; +use bevy::transform::TransformSystem; use bevy_xpbd_3d::prelude::*; -use bevy_xpbd_3d::{PhysicsSchedule, PhysicsStepSet}; use std::f32::consts::*; use crate::{settings, audio, actor}; @@ -15,7 +15,9 @@ impl Plugin for CameraControllerPlugin { app.add_systems(Startup, setup_camera); app.add_systems(Update, handle_input); app.add_systems(Update, manage_player_actor); - app.add_systems(PhysicsSchedule, sync_camera_to_player.in_set(PhysicsStepSet::BroadPhase)); + app.add_systems(PostUpdate, sync_camera_to_player + .after(PhysicsSet::Sync) + .before(TransformSystem::TransformPropagate)); app.add_systems(Update, update_fov); app.add_systems(Update, apply_input_to_player); }