pub struct Body3D {
pub position: Vec3,
pub half_size: Vec3,
pub velocity: Vec3,
pub grounded: bool,
}Expand description
Corresponding 3D character body. Positive Y is up.
Fields§
§position: Vec3Center position in world units.
half_size: Vec3Half dimensions of the collision box.
velocity: Vec3Velocity in world units per second.
grounded: boolWhether the last movement touched a solid while moving down.
Implementations§
Source§impl Body3D
impl Body3D
Sourcepub fn new(position: Vec3, size: Vec3) -> Self
pub fn new(position: Vec3, size: Vec3) -> Self
Creates a stationary body from its center and full dimensions.
Sourcepub fn move_and_slide(&mut self, dt: f32, solids: &[Aabb3])
pub fn move_and_slide(&mut self, dt: f32, solids: &[Aabb3])
Integrates velocity and slides along static boxes, resolving X, Z then Y.
Clipped velocity components become zero. dt must be finite and nonnegative.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Body3D
impl RefUnwindSafe for Body3D
impl Send for Body3D
impl Sync for Body3D
impl Unpin for Body3D
impl UnsafeUnpin for Body3D
impl UnwindSafe for Body3D
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