#[non_exhaustive]pub struct WorldCcdConfig { /* private fields */ }Expand description
The setting for continuous collision in the world step (see the module
documentation of world_ccd for the method).
Built with Self::new (off) or Self::on and adjusted with the
with_* methods; the fields cannot be written from outside the crate.
§Examples
use alice_physics::{Fix128, PhysicsConfig, PhysicsWorld, WorldCcdConfig};
let mut world = PhysicsWorld::new(PhysicsConfig::default());
assert!(!world.continuous_collision().is_enabled());
world.set_continuous_collision(WorldCcdConfig::on().with_motion_threshold(Fix128::from_ratio(1, 2)));
assert!(world.continuous_collision().is_enabled());
assert_eq!(world.continuous_collision().motion_threshold(), Fix128::from_ratio(1, 2));Implementations§
Source§impl WorldCcdConfig
impl WorldCcdConfig
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Off, with the default threshold 1 (a body is swept when it moves more
than its collision radius in one substep).
Sourcepub const fn with_enabled(self, enabled: bool) -> Self
pub const fn with_enabled(self, enabled: bool) -> Self
The same setting, switched on or off.
Sourcepub const fn with_motion_threshold(self, threshold: Fix128) -> Self
pub const fn with_motion_threshold(self, threshold: Fix128) -> Self
The same setting with another threshold, in collision radii: a body is
swept when its displacement in one substep is longer than
threshold × radius. A threshold ≤ 0 sweeps every moving body.
Sourcepub const fn is_enabled(&self) -> bool
pub const fn is_enabled(&self) -> bool
Whether the step sweeps fast bodies.
Sourcepub const fn motion_threshold(&self) -> Fix128
pub const fn motion_threshold(&self) -> Fix128
The threshold, in collision radii.
Trait Implementations§
Source§impl Clone for WorldCcdConfig
impl Clone for WorldCcdConfig
impl Copy for WorldCcdConfig
Source§impl Debug for WorldCcdConfig
impl Debug for WorldCcdConfig
Source§impl Default for WorldCcdConfig
impl Default for WorldCcdConfig
impl Eq for WorldCcdConfig
Source§impl PartialEq for WorldCcdConfig
impl PartialEq for WorldCcdConfig
impl StructuralPartialEq for WorldCcdConfig
Auto Trait Implementations§
impl Freeze for WorldCcdConfig
impl RefUnwindSafe for WorldCcdConfig
impl Send for WorldCcdConfig
impl Sync for WorldCcdConfig
impl Unpin for WorldCcdConfig
impl UnsafeUnpin for WorldCcdConfig
impl UnwindSafe for WorldCcdConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more