diff --git a/src/camera.rs b/src/camera.rs index 775b10b..56b9ed6 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -26,7 +26,6 @@ use std::f32::consts::PI; use std::f64::consts::PI as PI64; use crate::{actor, audio, hud, var}; -const CENTER_WORLD_ON_PLAYER: bool = true; pub const INITIAL_ZOOM_LEVEL: f64 = 10.0; pub struct CameraPlugin; @@ -48,17 +47,16 @@ impl Plugin for CameraPlugin { .before(TransformSystem::TransformPropagate)); app.insert_resource(MapCam::default()); - if CENTER_WORLD_ON_PLAYER { - // Disable bevy_xpbd's position->transform sync function - app.insert_resource(sync::SyncConfig { - position_to_transform: true, - transform_to_position: false, - }); - // Add own position->transform sync function - app.add_systems(PostUpdate, position_to_transform - .after(sync::position_to_transform) - .in_set(sync::SyncSet::PositionToTransform)); - } + // To center the renderer origin on the player camera, + // 1. Disable bevy_xpbd's position->transform sync function + app.insert_resource(sync::SyncConfig { + position_to_transform: true, + transform_to_position: false, + }); + // 2. Add own position->transform sync function + app.add_systems(PostUpdate, position_to_transform + .after(sync::position_to_transform) + .in_set(sync::SyncSet::PositionToTransform)); } }