From ce3847cb7e3f5eb70960368acf8568f859ecc29b Mon Sep 17 00:00:00 2001 From: Thierry Berger Date: Mon, 4 Nov 2024 17:25:24 +0100 Subject: [PATCH] Use `bevy_math::bounding::aabb3d` and `bevy_math::bounding::aabb2d` (#588) --- CHANGELOG.md | 2 ++ src/plugin/context/mod.rs | 14 ++++---------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5b8ddc1..509033c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,8 @@ on the responsible entity owning the `RenderContext`. - If you are building a library on top of `bevy_rapier` and would want to support multiple independent physics worlds too, you can check out the details of [#545](https://github.com/dimforge/bevy_rapier/pull/545) to get more context and information. +- `colliders_with_aabb_intersecting_aabb` now takes `bevy::math::bounding::Aabb3d` (or `[..]::Aabb2d` in 2D) as parameter. + - it is now accessible with `headless` feature enabled. ## v0.27.0 (07 July 2024) diff --git a/src/plugin/context/mod.rs b/src/plugin/context/mod.rs index 63205b0d..c239ec13 100644 --- a/src/plugin/context/mod.rs +++ b/src/plugin/context/mod.rs @@ -772,21 +772,15 @@ impl RapierContext { } /// Finds all entities of all the colliders with an Aabb intersecting the given Aabb. - #[cfg(not(feature = "headless"))] pub fn colliders_with_aabb_intersecting_aabb( &self, - aabb: bevy::render::primitives::Aabb, + #[cfg(feature = "dim2")] aabb: bevy::math::bounding::Aabb2d, + #[cfg(feature = "dim3")] aabb: bevy::math::bounding::Aabb3d, mut callback: impl FnMut(Entity) -> bool, ) { - #[cfg(feature = "dim2")] let scaled_aabb = rapier::prelude::Aabb { - mins: aabb.min().xy().into(), - maxs: aabb.max().xy().into(), - }; - #[cfg(feature = "dim3")] - let scaled_aabb = rapier::prelude::Aabb { - mins: aabb.min().into(), - maxs: aabb.max().into(), + mins: aabb.min.into(), + maxs: aabb.max.into(), }; #[allow(clippy::redundant_closure)] // False-positive, we can't move callback, closure becomes `FnOnce`