Skip to content

Commit 29b6ca7

Browse files
authored
Add From Cuboid for Aabb3d (#21392)
# Objective - be able to use Cuboid with Into<Aabb3d> methods ## Solution - impl From ## Testing ci
1 parent bb01a9f commit 29b6ca7

File tree

1 file changed

+10
-0
lines changed
  • crates/bevy_math/src/bounding/bounded3d

1 file changed

+10
-0
lines changed

crates/bevy_math/src/bounding/bounded3d/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use glam::Mat3;
66
use super::{BoundingVolume, IntersectsVolume};
77
use crate::{
88
ops::{self, FloatPow},
9+
primitives::Cuboid,
910
Isometry3d, Quat, Vec3A,
1011
};
1112

@@ -119,6 +120,15 @@ impl Aabb3d {
119120
}
120121
}
121122

123+
impl From<Cuboid> for Aabb3d {
124+
fn from(value: Cuboid) -> Self {
125+
Aabb3d {
126+
min: (-value.half_size).into(),
127+
max: value.half_size.into(),
128+
}
129+
}
130+
}
131+
122132
impl BoundingVolume for Aabb3d {
123133
type Translation = Vec3A;
124134
type Rotation = Quat;

0 commit comments

Comments
 (0)