No need to calculate AABB separately.
This commit is contained in:
parent
224a4043e2
commit
2379ee6900
|
@ -177,13 +177,13 @@ fn update_opacity_map(
|
||||||
mut opacity_map: ResMut<OpacityMap>,
|
mut opacity_map: ResMut<OpacityMap>,
|
||||||
spatial_query: SpatialQuery,
|
spatial_query: SpatialQuery,
|
||||||
query: Query<
|
query: Query<
|
||||||
(Entity, &GlobalTransform, &Collider, &Visible),
|
(Entity, &GlobalTransform, &ColliderAabb, &Visible),
|
||||||
Or<(Changed<GlobalTransform>, Changed<Visible>)>,
|
Or<(Changed<GlobalTransform>, Changed<Visible>)>,
|
||||||
>,
|
>,
|
||||||
visible: Query<(Entity, &GlobalTransform, &Collider, &Visible)>,
|
visible: Query<(Entity, &GlobalTransform, &Collider, &Visible)>,
|
||||||
) {
|
) {
|
||||||
let mut to_update = HashSet::new();
|
let mut to_update = HashSet::new();
|
||||||
for (entity, transform, collider, _) in &query {
|
for (entity, transform, aabb, _) in &query {
|
||||||
// println!(
|
// println!(
|
||||||
// "Updating {entity} at {:?}",
|
// "Updating {entity} at {:?}",
|
||||||
// transform.translation().truncate().as_ivec2()
|
// transform.translation().truncate().as_ivec2()
|
||||||
|
@ -197,7 +197,6 @@ fn update_opacity_map(
|
||||||
}
|
}
|
||||||
let mut current = HashSet::new();
|
let mut current = HashSet::new();
|
||||||
current.insert(transform.translation().truncate().as_ivec2());
|
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 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 {
|
for y in aabb.min.y as i32..aabb.max.y as i32 {
|
||||||
// println!(
|
// println!(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user