bevy/examples/movement
Jan Hohenheim 36fb83fa42
Port the physics in fixed timestep example to 3D (#20089)
# Objective

Since I originally wrote this example, many people on Discord have asked
me specifically how to handle camera movement in and around fixed
timesteps. I had to write that information up maaaany times, so I
believe this is an area where the example falls short of.

## Solution

Let's port the example to 3D, where we can better showcase how to handle
the camera. The knowledge is trivially transferable to 2D :)
Also, we don't need to average out continuous input. Just using the last
one is fine in practice. Still, we need to keep around the
`AccumulatedInput` resource for things like jumping.

## Testing


https://github.com/user-attachments/assets/c1306d36-1f94-43b6-b8f6-af1cbb622698

## Notes

- The current implementation is extremely faithful to how it will look
like in practice when writing a 3D game using e.g. Avian. With the
exception that Avian does the part with the actual physics of course
- I'd love to showcase how to map sequences of inputs to fixed updates,
but winit does not export timestamps
- I'd also like to showcase instantaneous inputs like activating a boost
or shooting a laser, but that would make the example even bigger
- Not locking the cursor because doing so correctly on Wasm in the
current Bevy version is not trivial at all

---------

Co-authored-by: Joona Aalto <jondolf.dev@gmail.com>
2025-07-14 21:20:19 +00:00
..
physics_in_fixed_timestep.rs Port the physics in fixed timestep example to 3D (#20089) 2025-07-14 21:20:19 +00:00
smooth_follow.rs