bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.24k stars 3.58k forks source link

Bevy should supply types and patterns for interpolating transforms with fixed timesteps #13773

Closed alice-i-cecile closed 5 months ago

alice-i-cecile commented 5 months ago

What problem does this solve or what need does it fill?

When working with fixed time, the correct pattern is to mutate "gameplay position" data, then interpolate the rendered transform based on the elapsed time.

Bevy does not currently (0.14) do this by default, and does not provide the tools or learning material to do this either.

What solution would you like?

  1. Bevy introduces a trait for gameplay transforms.
  2. Bevy provides a generic system to interpolate positions correctly that requires this trait.
  3. A generic plugin is provided to add this plugin in the correct spot in the schedule.
  4. Most of our examples are moved off fixed time, but a new example and new game are added to demonstrate this pattern.

What alternative(s) have you considered?

We could add our own gameplay transform type(s), but the exact needs will vary quite a bit between game types. I think the trait is probably the right interface.

Additional context

This was raised by Otoya and explained by @inodentry here.

https://github.com/bevyengine/bevy/issues/13306 proposes related functionality for checking simulation time.

alice-i-cecile commented 5 months ago

https://github.com/bevyengine/bevy/issues/1259 previously proposed this. Closing in favor of that issue.