pub struct WorldAabb {
min_x: f64,
min_y: f64,
min_z: f64,
max_x: f64,
max_y: f64,
max_z: f64,
}Expand description
World-space axis-aligned box used by entity and collision physics.
Fields§
§min_x: f64§min_y: f64§min_z: f64§max_x: f64§max_y: f64§max_z: f64Implementations§
Source§impl WorldAabb
impl WorldAabb
Sourcepub const fn new(
min_x: f64,
min_y: f64,
min_z: f64,
max_x: f64,
max_y: f64,
max_z: f64,
) -> Self
pub const fn new( min_x: f64, min_y: f64, min_z: f64, max_x: f64, max_y: f64, max_z: f64, ) -> Self
Creates a world-space AABB and normalizes endpoint order like vanilla
AABB.
Sourcepub fn entity_box(x: f64, y: f64, z: f64, half_width: f64, height: f64) -> Self
pub fn entity_box(x: f64, y: f64, z: f64, half_width: f64, height: f64) -> Self
Creates an entity bounding box centered on X/Z and using y as feet.
Sourcepub const fn is_empty(self) -> bool
pub const fn is_empty(self) -> bool
Returns true when this box has no positive volume on at least one axis.
Sourcepub fn move_by(self, dx: f64, dy: f64, dz: f64) -> Self
pub fn move_by(self, dx: f64, dy: f64, dz: f64) -> Self
Returns this box translated by the given delta.
Sourcepub fn inflate(self, amount: f64) -> Self
pub fn inflate(self, amount: f64) -> Self
Returns this box expanded by amount in every direction.
Sourcepub fn inflate_xyz(self, x: f64, y: f64, z: f64) -> Self
pub fn inflate_xyz(self, x: f64, y: f64, z: f64) -> Self
Returns this box expanded independently on each axis.
Sourcepub fn deflate(self, amount: f64) -> Self
pub fn deflate(self, amount: f64) -> Self
Returns this box shrunk by amount in every direction.
Sourcepub fn expand_towards(self, delta: DVec3) -> Self
pub fn expand_towards(self, delta: DVec3) -> Self
Returns this box expanded only in the direction of delta.
Sourcepub fn intersects(self, other: Self) -> bool
pub fn intersects(self, other: Self) -> bool
Returns true if this box intersects other.
Sourcepub fn intersects_coords(
self,
min_x: f64,
min_y: f64,
min_z: f64,
max_x: f64,
max_y: f64,
max_z: f64,
) -> bool
pub fn intersects_coords( self, min_x: f64, min_y: f64, min_z: f64, max_x: f64, max_y: f64, max_z: f64, ) -> bool
Returns true if this box intersects the given raw coordinate bounds.
Sourcepub fn intersects_block(self, pos: BlockPos) -> bool
pub fn intersects_block(self, pos: BlockPos) -> bool
Returns true if this box intersects the full block at pos.
Trait Implementations§
impl Copy for WorldAabb
impl StructuralPartialEq for WorldAabb
Auto Trait Implementations§
impl Freeze for WorldAabb
impl RefUnwindSafe for WorldAabb
impl Send for WorldAabb
impl Sync for WorldAabb
impl Unpin for WorldAabb
impl UnsafeUnpin for WorldAabb
impl UnwindSafe for WorldAabb
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more