[][src]Struct amethyst_physics::PhysicsTime

pub struct PhysicsTime { /* fields omitted */ }

This resource is used by amethyst_physics to keep track of the physics time.

You can use it to know the actual physics delta time, or to change the physics frame per second.

Max sub steps

Depending on the PhysicsTime::_time_bank value, could be necessary run the stepping, multiple times on the same frame.

Each frame, to the _time_bank is added the frame delta time (which is variable).

Sometimes, could happens that the Timer::delta_time is so big that too much sub steps have to be processed in order to consume the _time_bank. This process, will increase the delta time of the next frame, entering so in a spiral that will drop the performances.

To break this behavior a fall back algorithm, will clamp the maximum size of the _time_bank.

You can control the maximum _time_bank by changing the max_sub_steps.

Methods

impl PhysicsTime[src]

pub fn delta_seconds(&self) -> f32[src]

Get the physics delta seconds

pub fn in_sub_step(&self) -> bool[src]

Returns true if the sub stepping is in process.

pub fn with_frames_per_second(self, frames_per_seconds: u32) -> Self[src]

Set the physics frames per seconds.

pub fn set_frames_per_seconds(&mut self, frames_per_seconds: u32)[src]

Set the physics frames per seconds.

pub fn with_max_sub_steps(self, max_sub_steps: u32) -> Self[src]

Set the physics max sub steps. This controls how much physics step can be executed in a single frame. It's used to avoid spiral performance degradation. Set it to an too high value, will make this mechanism ineffective, and a too low value will make the physics unstable. Is advised to keep the default

pub fn set_max_sub_steps(&mut self, max_sub_steps: u32)[src]

Set the physics max sub steps. This controls how much physics step can be executed in a single frame. It's used to avoid spiral performance degradation. Set it to an too high value, will make this mechanism ineffective, and a too low value will make the physics unstable. Is advised to keep the default

pub fn sub_max_sub_steps(&self) -> u32[src]

Returns the max sub steps

Trait Implementations

impl Default for PhysicsTime[src]

impl Debug for PhysicsTime[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T> Any for T where
    T: Any

impl<T> Resource for T where
    T: Any + Send + Sync

impl<T> TryDefault for T where
    T: Default

impl<T> Event for T where
    T: Send + Sync + 'static,