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