Struct bevy::time::FixedTimestep
pub struct FixedTimestep { /* private fields */ }
Expand description
A system run criteria that enables systems or stages to run at a fixed timestep between executions.
This does not guarantee that the time elapsed between executions is exactly the provided fixed timestep, but will guarantee that the execution will run multiple times per game tick until the number of repetitions is as expected.
For example, a system with a fixed timestep run criteria of 120 times per second will run two times during a ~16.667ms frame, once during a ~8.333ms frame, and once every two frames with ~4.167ms frames. However, the same criteria may not result in exactly 8.333ms passing between each execution.
When using this run criteria, it is advised not to rely on Time::delta
or any of it’s
variants for game simulation, but rather use the constant time delta used to initialize the
FixedTimestep
instead.
For more fine tuned information about the execution status of a given fixed timestep,
use the FixedTimesteps
resource.
Implementations
impl FixedTimestep
impl FixedTimestep
pub fn step(step: f64) -> FixedTimestep
pub fn step(step: f64) -> FixedTimestep
Creates a FixedTimestep
that ticks once every step
seconds.
pub fn steps_per_second(rate: f64) -> FixedTimestep
pub fn steps_per_second(rate: f64) -> FixedTimestep
Creates a FixedTimestep
that ticks once every rate
times per second.
pub fn with_label(self, label: &str) -> FixedTimestep
pub fn with_label(self, label: &str) -> FixedTimestep
Sets the label for the timestep. Setting a label allows a timestep
to be observed by the global FixedTimesteps
resource.
Trait Implementations
impl Default for FixedTimestep
impl Default for FixedTimestep
fn default() -> FixedTimestep
fn default() -> FixedTimestep
impl System for FixedTimestep
impl System for FixedTimestep
fn archetype_component_access(&self) -> &Access<ArchetypeComponentId>
fn archetype_component_access(&self) -> &Access<ArchetypeComponentId>
Access
.fn component_access(&self) -> &Access<ComponentId>
fn component_access(&self) -> &Access<ComponentId>
Access
.fn is_exclusive(&self) -> bool
fn is_exclusive(&self) -> bool
unsafe fn run_unsafe(&mut self, _input: (), world: &World) -> ShouldRun
unsafe fn run_unsafe(&mut self, _input: (), world: &World) -> ShouldRun
System::run
, this function
takes a shared reference to World
and may therefore break Rust’s aliasing rules, making
it unsafe to call. Read morefn apply_buffers(&mut self, world: &mut World)
fn initialize(&mut self, world: &mut World)
fn initialize(&mut self, world: &mut World)
fn update_archetype_component_access(&mut self, world: &World)
fn update_archetype_component_access(&mut self, world: &World)
Access
.fn check_change_tick(&mut self, change_tick: u32)
fn get_last_change_tick(&self) -> u32
fn get_last_change_tick(&self) -> u32
fn set_last_change_tick(&mut self, last_change_tick: u32)
fn set_last_change_tick(&mut self, last_change_tick: u32)
fn run(&mut self, input: Self::In, world: &mut World) -> Self::Out
fn run(&mut self, input: Self::In, world: &mut World) -> Self::Out
fn default_labels(&self) -> Vec<SystemLabelId, Global>ⓘ
fn default_labels(&self) -> Vec<SystemLabelId, Global>ⓘ
Auto Trait Implementations
impl !RefUnwindSafe for FixedTimestep
impl Send for FixedTimestep
impl Sync for FixedTimestep
impl Unpin for FixedTimestep
impl !UnwindSafe for FixedTimestep
Blanket Implementations
impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist. Read moresourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
. Read morefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read morefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read morefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read moreimpl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given Worldsourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘ
fn instrument(self, span: Span) -> Instrumented<Self>ⓘ
sourcefn in_current_span(self) -> Instrumented<Self>ⓘ
fn in_current_span(self) -> Instrumented<Self>ⓘ
impl<SystemA, ParamA, Payload, SystemB, ParamB, Out> IntoPipeSystem<ParamA, Payload, SystemB, ParamB, Out> for SystemAwhere
SystemA: IntoSystem<(), Payload, ParamA>,
SystemB: IntoSystem<Payload, Out, ParamB>,
impl<SystemA, ParamA, Payload, SystemB, ParamB, Out> IntoPipeSystem<ParamA, Payload, SystemB, ParamB, Out> for SystemAwhere
SystemA: IntoSystem<(), Payload, ParamA>,
SystemB: IntoSystem<Payload, Out, ParamB>,
fn pipe(
self,
system: SystemB
) -> PipeSystem<<SystemA as IntoSystem<(), Payload, ParamA>>::System, <SystemB as IntoSystem<Payload, Out, ParamB>>::System>
fn pipe(
self,
system: SystemB
) -> PipeSystem<<SystemA as IntoSystem<(), Payload, ParamA>>::System, <SystemB as IntoSystem<Payload, Out, ParamB>>::System>
A
into a second system B
, creating a new compound system.impl<S, Param> IntoRunCriteria<(Box<dyn System<In = (), Out = ShouldRun> + 'static, Global>, Param)> for Swhere
S: IntoSystem<(), ShouldRun, Param>,
impl<S, Param> IntoRunCriteria<(Box<dyn System<In = (), Out = ShouldRun> + 'static, Global>, Param)> for Swhere
S: IntoSystem<(), ShouldRun, Param>,
fn into(self) -> RunCriteriaDescriptorOrLabel
impl<In, Out, Sys> IntoSystem<In, Out, AlreadyWasSystem> for Syswhere
Sys: System<In = In, Out = Out>,
impl<In, Out, Sys> IntoSystem<In, Out, AlreadyWasSystem> for Syswhere
Sys: System<In = In, Out = Out>,
type System = Sys
fn into_system(this: Sys) -> Sys
fn into_system(this: Sys) -> Sys
System
.