Expand description
This module is not related to the interpolating between server updates. Instead, it is responsible for interpolating between FixedUpdate ticks during the Update state.
Usually, the simulation is run during the FixedUpdate schedule so that it doesn’t depend on frame rate. This can cause some visual inconsistencies (jitter) because the frames (Update schedule) don’t correspond exactly to the FixedUpdate schedule: there can be frames with several fixed-update ticks, and some frames with no fixed-update ticks.
To solve this, we will visually display the state of the game with 1 tick of delay For example if on the Update state we have an overstep of 0.7 and the current tick is 10, we will display the state of the game interpolated at 0.7 between tick 9 and tick 10.
Another way to solve this would to run an extra ‘partial’ simulation step with 0.7 dt and use this for the visual state.
To enable FrameInterpolation:
- you will have to register an interpolation function for the component in the protocol
- FrameInterpolation is not enabled by default, you have to add the plugin manually
- To enable VisualInterpolation on a given entity, you need to add the
FrameInterpolate
component to it manually
let mut app = App::new();
app.add_plugins(FrameInterpolationPlugin::<Component1>::default());
fn spawn_entity(mut commands: Commands) {
commands.spawn(FrameInterpolate::<Component1>::default());
}
Modules§
Structs§
- Frame
Interpolate - Component that stores the previous value of a component for visual interpolation For now we will only use this to interpolate components that are updated during the FixedUpdate schedule. Hence, some values are not included in the struct:
- Frame
Interpolation Plugin - Bevy plugin to enable visual interpolation for a specific component
C
.
Enums§
- Frame
Interpolation Set - System sets used by the
FrameInterpolationPlugin
.