remove CENTER_WORLD_ON_PLAYER feature flag (always enabled now)

This commit is contained in:
yuni 2024-05-07 21:32:34 +02:00
parent ddf197c057
commit 0f5c4d1d89

View file

@ -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));
}
}