From 2379ee690022dfc580c7132ba814042c024e0760 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Tue, 3 Dec 2024 21:38:55 -0600 Subject: [PATCH] No need to calculate AABB separately. --- src/visibility.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/visibility.rs b/src/visibility.rs index 618e43b..1342178 100644 --- a/src/visibility.rs +++ b/src/visibility.rs @@ -177,13 +177,13 @@ fn update_opacity_map( mut opacity_map: ResMut, spatial_query: SpatialQuery, query: Query< - (Entity, &GlobalTransform, &Collider, &Visible), + (Entity, &GlobalTransform, &ColliderAabb, &Visible), Or<(Changed, Changed)>, >, visible: Query<(Entity, &GlobalTransform, &Collider, &Visible)>, ) { let mut to_update = HashSet::new(); - for (entity, transform, collider, _) in &query { + for (entity, transform, aabb, _) in &query { // println!( // "Updating {entity} at {:?}", // transform.translation().truncate().as_ivec2() @@ -197,7 +197,6 @@ fn update_opacity_map( } let mut current = HashSet::new(); current.insert(transform.translation().truncate().as_ivec2()); - let aabb = collider.aabb(transform.translation().truncate(), transform); for x in aabb.min.x as i32..aabb.max.x as i32 { for y in aabb.min.y as i32..aabb.max.y as i32 { // println!(