diff --git a/crates/energy/src/graph.rs b/crates/energy/src/graph.rs index d3ca7f54..acce9f2a 100644 --- a/crates/energy/src/graph.rs +++ b/crates/energy/src/graph.rs @@ -27,7 +27,7 @@ impl Plugin for GraphPlugin { .add_systems(OnExit(GameState::Playing), clean_up) .add_systems(PostUpdate, spawn_graph_components) .add_systems( - PreUpdate, + FixedUpdate, ( remove_old_nodes.before(GraphSystemSet::UpdateNearby), update_nearby_recv.in_set(GraphSystemSet::UpdateNearby), diff --git a/src/main.rs b/src/main.rs index a4a49204..ff751d1a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -34,6 +34,7 @@ use tracing::{span, Level}; const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION"); const GIT_SHA: &str = env!("GIT_SHA"); +const FIXED_TIMESTEP: f32 = 1. / 10.; // 10 ticks per second fn main() { let mut app = App::new(); @@ -50,6 +51,7 @@ fn main() { let _enter = span.enter(); app.insert_resource(Msaa::Sample4) + .insert_resource(FixedTime::new_from_secs(FIXED_TIMESTEP)) .add_plugins( DefaultPlugins .set(WindowPlugin {