@@ -12,8 +12,7 @@ use crate::{time::Time, virt::Virtual, FixedUpdate};
1212/// It is automatically inserted as a resource by
1313/// [`TimePlugin`](crate::TimePlugin) and updated based on
1414/// [`Time<Virtual>`](Virtual). The fixed clock is automatically set as the
15- /// generic [`Time`] resource during [`FixedUpdate`](bevy_app::FixedUpdate)
16- /// schedule processing.
15+ /// generic [`Time`] resource during [`FixedUpdate`] schedule processing.
1716///
1817/// The fixed timestep clock advances in fixed-size increments, which is
1918/// extremely useful for writing logic (like physics) that should have
@@ -27,13 +26,12 @@ use crate::{time::Time, virt::Virtual, FixedUpdate};
2726/// frame). Additionally, the value is a power of two which losslessly converts
2827/// into [`f32`] and [`f64`].
2928///
30- /// To run a system on a fixed timestep, add it to the
31- /// [`FixedUpdate`](bevy_app::FixedUpdate) schedule. This schedule is run a
32- /// number of times between [`PreUpdate`](bevy_app::PreUpdate) and
33- /// [`Update`](bevy_app::Update) according to the accumulated
34- /// [`overstep()`](Time::overstep) time divided by the
35- /// [`timestep()`](Time::timestep). This means the schedule may run 0, 1 or more
36- /// times during a single update (which typically corresponds to a rendered
29+ /// To run a system on a fixed timestep, add it to the [`FixedUpdate`] schedule.
30+ /// This schedule is run a number of times between
31+ /// [`PreUpdate`](bevy_app::PreUpdate) and [`Update`](bevy_app::Update)
32+ /// according to the accumulated [`overstep()`](Time::overstep) time divided by
33+ /// the [`timestep()`](Time::timestep). This means the schedule may run 0, 1 or
34+ /// more times during a single update (which typically corresponds to a rendered
3735/// frame).
3836///
3937/// `Time<Fixed>` and the generic [`Time`] resource will report a
@@ -45,21 +43,20 @@ use crate::{time::Time, virt::Virtual, FixedUpdate};
4543/// means it is affected by [`pause()`](Time::pause),
4644/// [`set_relative_speed()`](Time::set_relative_speed) and
4745/// [`set_max_delta()`](Time::set_max_delta) from virtual time. If the virtual
48- /// clock is paused, the [`FixedUpdate`](bevy_app::FixedUpdate) schedule will
49- /// not run. It is guaranteed that the [`elapsed()`](Time::elapsed) time in
50- /// `Time<Fixed>` is always between the previous `elapsed()` and the current
51- /// `elapsed()` value in ` Time<Virtual>`, so the values are compatible.
46+ /// clock is paused, the [`FixedUpdate`] schedule will not run. It is guaranteed
47+ /// that the [`elapsed()`](Time::elapsed) time in `Time<Fixed>` is always
48+ /// between the previous `elapsed()` and the current `elapsed()` value in
49+ /// `Time<Virtual>`, so the values are compatible.
5250///
5351/// Changing the timestep size while the game is running should not normally be
5452/// done, as having a regular interval is the point of this schedule, but it may
5553/// be necessary for effects like "bullet-time" if the normal granularity of the
5654/// fixed timestep is too big for the slowed down time. In this case,
5755/// [`set_timestep()`](Time::set_timestep) and be called to set a new value. The
58- /// new value will be used immediately for the next run of the
59- /// [`FixedUpdate`](bevy_app::FixedUpdate) schedule, meaning that it will affect
60- /// the [`delta()`](Time::delta) value for the very next
61- /// [`FixedUpdate`](bevy_app::FixedUpdate), even if it is still during the same
62- /// frame. Any [`overstep()`](Time::overstep) present in the accumulator will be
56+ /// new value will be used immediately for the next run of the [`FixedUpdate`]
57+ /// schedule, meaning that it will affect the [`delta()`](Time::delta) value for
58+ /// the very next [`FixedUpdate`], even if it is still during the same frame.
59+ /// Any [`overstep()`](Time::overstep) present in the accumulator will be
6360/// processed according to the new [`timestep()`](Time::timestep) value.
6461#[ derive( Debug , Copy , Clone , Reflect ) ]
6562pub struct Fixed {
@@ -71,8 +68,7 @@ impl Time<Fixed> {
7168 /// Corresponds to 64 Hz.
7269 const DEFAULT_TIMESTEP : Duration = Duration :: from_micros ( 15625 ) ;
7370
74- /// Return new fixed time clock with given timestep as
75- /// [`Duration`](std::time::Duration)
71+ /// Return new fixed time clock with given timestep as [`Duration`]
7672 ///
7773 /// # Panics
7874 ///
@@ -113,7 +109,7 @@ impl Time<Fixed> {
113109 }
114110
115111 /// Sets the amount of virtual time that must pass before the fixed timestep
116- /// schedule is run again, as [`Duration`](std::time::Duration) .
112+ /// schedule is run again, as [`Duration`].
117113 ///
118114 /// Takes effect immediately on the next run of the schedule, respecting
119115 /// what is currently in [`Self::overstep`].
@@ -134,9 +130,8 @@ impl Time<Fixed> {
134130 /// Sets the amount of virtual time that must pass before the fixed timestep
135131 /// schedule is run again, as seconds.
136132 ///
137- /// Timestep is stored as a [`Duration`](std::time::Duration), which has
138- /// fixed nanosecond resolution and will be converted from the floating
139- /// point number.
133+ /// Timestep is stored as a [`Duration`], which has fixed nanosecond
134+ /// resolution and will be converted from the floating point number.
140135 ///
141136 /// Takes effect immediately on the next run of the schedule, respecting
142137 /// what is currently in [`Self::overstep`].
@@ -157,8 +152,8 @@ impl Time<Fixed> {
157152 /// Sets the amount of virtual time that must pass before the fixed timestep
158153 /// schedule is run again, as frequency.
159154 ///
160- /// The timestep value is set to `1 / hz`, converted to a
161- /// [`Duration`](std::time::Duration) which has fixed nanosecond resolution.
155+ /// The timestep value is set to `1 / hz`, converted to a [`Duration`] which
156+ /// has fixed nanosecond resolution.
162157 ///
163158 /// Takes effect immediately on the next run of the schedule, respecting
164159 /// what is currently in [`Self::overstep`].
@@ -174,7 +169,7 @@ impl Time<Fixed> {
174169 }
175170
176171 /// Returns the amount of overstep time accumulated toward new steps, as
177- /// [`Duration`](std::time::Duration) .
172+ /// [`Duration`].
178173 #[ inline]
179174 pub fn overstep ( & self ) -> Duration {
180175 self . context ( ) . overstep
@@ -221,8 +216,8 @@ impl Default for Fixed {
221216 }
222217}
223218
224- /// Runs [`FixedUpdate`](bevy_app::FixedUpdate) zero or more times based on
225- /// delta of [`Time<Virtual>`](Virtual) and [`Time::overstep`]
219+ /// Runs [`FixedUpdate`] zero or more times based on delta of
220+ /// [`Time<Virtual>`](Virtual) and [`Time::overstep`]
226221pub fn run_fixed_update_schedule ( world : & mut World ) {
227222 let delta = world. resource :: < Time < Virtual > > ( ) . delta ( ) ;
228223 world. resource_mut :: < Time < Fixed > > ( ) . accumulate ( delta) ;
0 commit comments