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§
sourcefn from_timestep(timestep_mode: TimestepMode) -> Self
fn from_timestep(timestep_mode: TimestepMode) -> Self
Creates a new Time<Physics>
clock with the given type
of timestep.
sourcefn timestep_mode(&self) -> TimestepMode
fn timestep_mode(&self) -> TimestepMode
Gets the type of timestep used for running physics.
sourcefn timestep_mode_mut(&mut self) -> &mut TimestepMode
fn timestep_mode_mut(&mut self) -> &mut TimestepMode
Mutably gets the type of timestep used for running physics.
sourcefn set_timestep_mode(&mut self, timestep_mode: TimestepMode)
fn set_timestep_mode(&mut self, timestep_mode: TimestepMode)
Sets the type of timestep used for running physics.
sourcefn relative_speed(&self) -> f32
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.
sourcefn relative_speed_f64(&self) -> f64
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.
sourcefn with_relative_speed(self, ratio: f32) -> Self
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.
sourcefn with_relative_speed_f64(self, ratio: f64) -> Self
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.
sourcefn set_relative_speed(&mut self, ratio: f32)
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.
sourcefn set_relative_speed_f64(&mut self, ratio: f64)
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.