Don't update if physics is paused.

This commit is contained in:
Nolan Darilek 2025-01-03 11:15:32 -05:00
parent 34613bfe07
commit f6c34057aa

View File

@ -311,6 +311,7 @@ impl InputGrid for VisibilityGrid {
fn update_viewshed( fn update_viewshed(
mut commands: Commands, mut commands: Commands,
physics_time: Res<Time<Physics>>,
mut viewers: Query<( mut viewers: Query<(
Entity, Entity,
&mut Viewshed, &mut Viewshed,
@ -321,6 +322,9 @@ fn update_viewshed(
sensors: Query<&Sensor>, sensors: Query<&Sensor>,
spatial_query: SpatialQuery, spatial_query: SpatialQuery,
) { ) {
if physics_time.is_paused() {
return;
}
for (viewer_entity, mut viewshed, mut visible_entities, viewer_transform) in &mut viewers { for (viewer_entity, mut viewshed, mut visible_entities, viewer_transform) in &mut viewers {
viewshed.update( viewshed.update(
&mut commands, &mut commands,