Struct MultiRateSimClock
pub struct MultiRateSimClock {
pub physics_accumulator: FixedTimestepAccumulator,
pub lockstep_substep_ratio: u32,
pub substeps_since_lockstep: u32,
pub total_lockstep_ticks: u64,
}Expand description
Multi-rate simulation clock coordinating 64 Hz continuous physics substeps with deterministic lockstep world-state ticks.
Fields§
§physics_accumulator: FixedTimestepAccumulator64 Hz fixed timestep accumulator for high-rate continuous physics and character stepping.
lockstep_substep_ratio: u32Number of physics substeps required to trigger one lockstep tick (typically 3 for ~21.3 Hz ≈ 20 Hz).
substeps_since_lockstep: u32Accumulated physics substeps since the last lockstep tick.
total_lockstep_ticks: u64Total deterministic lockstep ticks executed.
Implementations§
§impl MultiRateSimClock
impl MultiRateSimClock
pub const fn new(lockstep_substep_ratio: u32) -> MultiRateSimClock
pub const fn new(lockstep_substep_ratio: u32) -> MultiRateSimClock
Creates a new MultiRateSimClock with the given substep-to-tick ratio.
pub fn advance(&mut self, raw_delta_seconds: f64) -> (usize, usize)
pub fn advance(&mut self, raw_delta_seconds: f64) -> (usize, usize)
Advances the clock by real frame delta time in seconds.
Returns (physics_substeps, lockstep_ticks) to execute during this frame.
pub fn interpolation_alpha(&self) -> f32
pub fn interpolation_alpha(&self) -> f32
Returns fractional blend factor $\alpha \in [0, 1)$ between the previous and current physics states for renderer interpolation.
pub fn reset(&mut self)
pub fn reset(&mut self)
Resets all counters and accumulator.
Trait Implementations§
§impl Clone for MultiRateSimClock
impl Clone for MultiRateSimClock
§fn clone(&self) -> MultiRateSimClock
fn clone(&self) -> MultiRateSimClock
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for MultiRateSimClock
§impl Debug for MultiRateSimClock
impl Debug for MultiRateSimClock
§impl Default for MultiRateSimClock
impl Default for MultiRateSimClock
§fn default() -> MultiRateSimClock
fn default() -> MultiRateSimClock
§impl PartialEq for MultiRateSimClock
impl PartialEq for MultiRateSimClock
impl StructuralPartialEq for MultiRateSimClock
Auto Trait Implementations§
impl Freeze for MultiRateSimClock
impl RefUnwindSafe for MultiRateSimClock
impl Send for MultiRateSimClock
impl Sync for MultiRateSimClock
impl Unpin for MultiRateSimClock
impl UnsafeUnpin for MultiRateSimClock
impl UnwindSafe for MultiRateSimClock
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more