Skip to main content

Sleepable

Trait Sleepable 

Source
pub trait Sleepable {
    // Required methods
    fn is_sleeping(&self) -> bool;
    fn wake(&mut self);
    fn sleep(&mut self);

    // Provided method
    fn should_sleep(
        &self,
        speed_sq: Real,
        threshold_sq: Real,
        accumulated_sleep_time: Real,
        time_to_sleep: Real,
    ) -> bool { ... }
}
Expand description

Trait for bodies that can sleep when below activity thresholds.

Required Methods§

Source

fn is_sleeping(&self) -> bool

Whether the body is currently sleeping.

Source

fn wake(&mut self)

Wake the body from sleep.

Source

fn sleep(&mut self)

Put the body to sleep, zeroing velocities.

Provided Methods§

Source

fn should_sleep( &self, speed_sq: Real, threshold_sq: Real, accumulated_sleep_time: Real, time_to_sleep: Real, ) -> bool

Test whether the body should fall asleep given its speed squared and the world’s thresholds.

Implementors§