Skip to content

Commit

Permalink
Use bevy_math::bounding::aabb3d and bevy_math::bounding::aabb2d (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Vrixyz authored Nov 4, 2024
1 parent 3cf2b93 commit ce3847c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
14 changes: 4 additions & 10 deletions src/plugin/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit ce3847c

Please sign in to comment.