Skip to content

Commit

Permalink
Add discard_overstep function to Time<Fixed>
Browse files Browse the repository at this point in the history
  • Loading branch information
NiseVoid committed Nov 8, 2023
1 parent 0cc1179 commit d5272ae
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/bevy_time/src/fixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ impl Time<Fixed> {
self.context().overstep
}

/// Discard a part of the overstep amount. If `discard` is higher than overstep,
/// overstep becomes zero.
#[inline]
pub fn discard_overstep(&mut self, discard: Duration) {
let context = self.context_mut();
context.overstep = context.overstep.saturating_sub(discard);
}

/// Returns the amount of overstep time accumulated toward new steps, as an
/// [`f32`] fraction of the timestep.
#[inline]
Expand Down

0 comments on commit d5272ae

Please sign in to comment.