pub struct SleepSystem {
pub energy_threshold: f32,
pub sleep_delay: f32,
/* private fields */
}Expand description
Manages sleeping bodies to skip expensive simulation when at rest.
Fields§
§energy_threshold: f32Kinetic energy threshold below which bodies become drowsy.
sleep_delay: f32Time a body must remain below threshold before sleeping (seconds).
Implementations§
Source§impl SleepSystem
impl SleepSystem
pub fn new(energy_threshold: f32, sleep_delay: f32) -> Self
Sourcepub fn update(
&mut self,
bodies: &mut HashMap<RigidBodyHandle, RigidBody>,
dt: f32,
) -> Vec<RigidBodyHandle>
pub fn update( &mut self, bodies: &mut HashMap<RigidBodyHandle, RigidBody>, dt: f32, ) -> Vec<RigidBodyHandle>
Update sleep states for all bodies. Returns handles that just went to sleep.
Sourcepub fn wake_body(
&mut self,
handle: RigidBodyHandle,
bodies: &mut HashMap<RigidBodyHandle, RigidBody>,
manifolds: &[ContactManifold3D],
)
pub fn wake_body( &mut self, handle: RigidBodyHandle, bodies: &mut HashMap<RigidBodyHandle, RigidBody>, manifolds: &[ContactManifold3D], )
Wake a body and propagate to all bodies connected by contacts.
Sourcepub fn wake_in_region(
&mut self,
region_min: Vec3,
region_max: Vec3,
bodies: &mut HashMap<RigidBodyHandle, RigidBody>,
manifolds: &[ContactManifold3D],
)
pub fn wake_in_region( &mut self, region_min: Vec3, region_max: Vec3, bodies: &mut HashMap<RigidBodyHandle, RigidBody>, manifolds: &[ContactManifold3D], )
Wake all bodies touching the given AABB.
pub fn sleeping_count( &self, bodies: &HashMap<RigidBodyHandle, RigidBody>, ) -> usize
Auto Trait Implementations§
impl Freeze for SleepSystem
impl RefUnwindSafe for SleepSystem
impl Send for SleepSystem
impl Sync for SleepSystem
impl Unpin for SleepSystem
impl UnsafeUnpin for SleepSystem
impl UnwindSafe for SleepSystem
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.