add CENTER_WORLD_ON_PLAYER constant
This commit is contained in:
parent
b583970a88
commit
84747e1c3a
|
@ -10,6 +10,8 @@ const ASTEROID_UPDATE_INTERVAL: f32 = 1.0; // seconds
|
|||
const ASTEROID_SIZE: f32 = 100.0;
|
||||
const STARS_MAX_MAGNITUDE: f32 = 5.5;
|
||||
|
||||
const CENTER_WORLD_ON_PLAYER: bool = true;
|
||||
|
||||
const ASSET_ASTEROID1: &str = "models/asteroid.glb#Scene0";
|
||||
const ASSET_ASTEROID2: &str = "models/asteroid2.glb#Scene0";
|
||||
pub fn asset_name_to_path(name: &str) -> &'static str {
|
||||
|
@ -42,14 +44,16 @@ impl Plugin for WorldPlugin {
|
|||
Timer::from_seconds(ASTEROID_UPDATE_INTERVAL, TimerMode::Repeating)));
|
||||
app.insert_resource(AsteroidDatabase(Vec::new()));
|
||||
|
||||
// Disable bevy_xpbd's position->transform sync because we have a
|
||||
// custom syncing function.
|
||||
if CENTER_WORLD_ON_PLAYER {
|
||||
// Disable bevy_xpbd's position->transform sync function
|
||||
app.insert_resource(SyncConfig {
|
||||
position_to_transform: false,
|
||||
transform_to_position: false,
|
||||
});
|
||||
// Add own position->transform sync function
|
||||
app.add_systems(PreUpdate, position_to_transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Resource)] struct AsteroidUpdateTimer(Timer);
|
||||
|
|
Loading…
Reference in a new issue