Trait avian3d::schedule::PhysicsTime

source ·
pub trait PhysicsTime {
Show 13 methods // Required methods fn from_timestep(timestep_mode: TimestepMode) -> Self; fn timestep_mode(&self) -> TimestepMode; fn timestep_mode_mut(&mut self) -> &mut TimestepMode; fn set_timestep_mode(&mut self, timestep_mode: TimestepMode); fn relative_speed(&self) -> f32; fn relative_speed_f64(&self) -> f64; fn with_relative_speed(self, ratio: f32) -> Self; fn with_relative_speed_f64(self, ratio: f64) -> Self; fn set_relative_speed(&mut self, ratio: f32); fn set_relative_speed_f64(&mut self, ratio: f64); fn is_paused(&self) -> bool; fn pause(&mut self); fn unpause(&mut self);
}
Expand description

An extension trait for Time<Physics>.

Required Methods§

source

fn from_timestep(timestep_mode: TimestepMode) -> Self

Creates a new Time<Physics> clock with the given type of timestep.

source

fn timestep_mode(&self) -> TimestepMode

Gets the type of timestep used for running physics.

source

fn timestep_mode_mut(&mut self) -> &mut TimestepMode

Mutably gets the type of timestep used for running physics.

source

fn set_timestep_mode(&mut self, timestep_mode: TimestepMode)

Sets the type of timestep used for running physics.

source

fn relative_speed(&self) -> f32

Returns the speed of physics relative to your system clock as an f32. This is also known as “time scaling” or “time dilation” in other engines.

The speed impacts the accuracy of the simulation, and large values may cause jittering or missed collisions. You can improve simulation consistency by adjusting your timestep at the cost of performance.

source

fn relative_speed_f64(&self) -> f64

Returns the speed of physics relative to your system clock as an f64. This is also known as “time scaling” or “time dilation” in other engines.

The speed impacts the accuracy of the simulation, and large values may cause jittering or missed collisions. You can improve simulation consistency by adjusting your timestep at the cost of performance.

source

fn with_relative_speed(self, ratio: f32) -> Self

Sets the speed of physics relative to your system clock, given as an f32.

For example, setting this to 2.0 will make the physics clock advance twice as fast as your system clock.

The speed impacts the accuracy of the simulation, and large values may cause jittering or missed collisions. You can improve simulation consistency by adjusting your timestep at the cost of performance.

§Panics

Panics if ratio is negative or not finite.

source

fn with_relative_speed_f64(self, ratio: f64) -> Self

Sets the speed of physics relative to your system clock, given as an f64.

For example, setting this to 2.0 will make the physics clock advance twice as fast as your system clock.

The speed impacts the accuracy of the simulation, and large values may cause jittering or missed collisions. You can improve simulation consistency by adjusting your timestep at the cost of performance.

§Panics

Panics if ratio is negative or not finite.

source

fn set_relative_speed(&mut self, ratio: f32)

Sets the speed of physics relative to your system clock, given as an f32.

For example, setting this to 2.0 will make the physics clock advance twice as fast as your system clock.

The speed impacts the accuracy of the simulation, and large values may cause jittering or missed collisions. You can improve simulation consistency by adjusting your timestep at the cost of performance.

§Panics

Panics if ratio is negative or not finite.

source

fn set_relative_speed_f64(&mut self, ratio: f64)

Sets the speed of physics relative to your system clock, given as an f64.

For example, setting this to 2.0 will make the physics clock advance twice as fast as your system clock.

The speed impacts the accuracy of the simulation, and large values may cause jittering or missed collisions. You can improve simulation consistency by adjusting your timestep at the cost of performance.

§Panics

Panics if ratio is negative or not finite.

source

fn is_paused(&self) -> bool

Returns true if the physics clock is currently paused.

source

fn pause(&mut self)

Stops the clock, preventing the physics simulation from advancing until resumed.

source

fn unpause(&mut self)

Resumes the clock if paused.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl PhysicsTime for Time<Physics>

source§

fn from_timestep(timestep_mode: TimestepMode) -> Self

source§

fn timestep_mode(&self) -> TimestepMode

source§

fn timestep_mode_mut(&mut self) -> &mut TimestepMode

source§

fn set_timestep_mode(&mut self, timestep_mode: TimestepMode)

source§

fn with_relative_speed(self, ratio: f32) -> Self

source§

fn with_relative_speed_f64(self, ratio: f64) -> Self

source§

fn relative_speed(&self) -> f32

source§

fn relative_speed_f64(&self) -> f64

source§

fn set_relative_speed(&mut self, ratio: f32)

source§

fn set_relative_speed_f64(&mut self, ratio: f64)

source§

fn pause(&mut self)

source§

fn unpause(&mut self)

source§

fn is_paused(&self) -> bool

Implementors§