Struct bevy_math::primitives::Cuboid
source · pub struct Cuboid {
pub half_size: Vec3,
}
Expand description
A cuboid primitive, more commonly known as a box.
Fields§
§half_size: Vec3
Half of the width, height and depth of the cuboid
Implementations§
source§impl Cuboid
impl Cuboid
sourcepub fn new(x_length: f32, y_length: f32, z_length: f32) -> Self
pub fn new(x_length: f32, y_length: f32, z_length: f32) -> Self
Create a new Cuboid
from a full x, y, and z length
sourcepub fn from_corners(point1: Vec3, point2: Vec3) -> Self
pub fn from_corners(point1: Vec3, point2: Vec3) -> Self
Create a new Cuboid
from two corner points
sourcepub fn closest_point(&self, point: Vec3) -> Vec3
pub fn closest_point(&self, point: Vec3) -> Vec3
Finds the point on the cuboid that is closest to the given point
.
If the point is outside the cuboid, the returned point will be on the surface of the cuboid. Otherwise, it will be inside the cuboid and returned as is.
Trait Implementations§
source§impl Bounded3d for Cuboid
impl Bounded3d for Cuboid
source§fn aabb_3d(&self, translation: Vec3, rotation: Quat) -> Aabb3d
fn aabb_3d(&self, translation: Vec3, rotation: Quat) -> Aabb3d
Get an axis-aligned bounding box for the shape with the given translation and rotation
source§fn bounding_sphere(&self, translation: Vec3, _rotation: Quat) -> BoundingSphere
fn bounding_sphere(&self, translation: Vec3, _rotation: Quat) -> BoundingSphere
Get a bounding sphere for the shape with the given translation and rotation
source§impl<'de> Deserialize<'de> for Cuboid
impl<'de> Deserialize<'de> for Cuboid
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for Cuboid
impl PartialEq for Cuboid
impl Copy for Cuboid
impl Primitive3d for Cuboid
impl StructuralPartialEq for Cuboid
Auto Trait Implementations§
impl RefUnwindSafe for Cuboid
impl Send for Cuboid
impl Sync for Cuboid
impl Unpin for Cuboid
impl UnwindSafe for Cuboid
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