diff --git a/Cargo.toml b/Cargo.toml index b3c056a763..f6a30b4892 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3258,6 +3258,17 @@ description = "Demonstrates how to enqueue custom draw commands in a render phas category = "Shaders" wasm = true +[[example]] +name = "physics_in_fixed_timestep" +path = "examples/movement/physics_in_fixed_timestep.rs" +doc-scrape-examples = true + +[package.metadata.example.physics_in_fixed_timestep] +name = "Run physics in a fixed timestep" +description = "Handles input, physics, and rendering in an industry-standard way by using a fixed timestep" +category = "Movement" +wasm = true + [profile.wasm-release] inherits = "release" opt-level = "z" diff --git a/examples/README.md b/examples/README.md index 55e148e236..d48f614787 100644 --- a/examples/README.md +++ b/examples/README.md @@ -53,6 +53,7 @@ git checkout v0.4.0 - [Gizmos](#gizmos) - [Input](#input) - [Math](#math) + - [Movement](#movement) - [Reflection](#reflection) - [Scene](#scene) - [Shaders](#shaders) @@ -337,6 +338,12 @@ Example | Description [Sampling Primitives](../examples/math/sampling_primitives.rs) | Demonstrates all the primitives which can be sampled. [Smooth Follow](../examples/math/smooth_follow.rs) | Demonstrates how to make an entity smoothly follow another using interpolation +## Movement + +Example | Description +--- | --- +[Run physics in a fixed timestep](../examples/movement/physics_in_fixed_timestep.rs) | Handles input, physics, and rendering in an industry-standard way by using a fixed timestep + ## Reflection Example | Description diff --git a/examples/camera/2d_top_down_camera.rs b/examples/camera/2d_top_down_camera.rs index ad565b36f5..9dde1463ba 100644 --- a/examples/camera/2d_top_down_camera.rs +++ b/examples/camera/2d_top_down_camera.rs @@ -4,9 +4,9 @@ //! //! | Key Binding | Action | //! |:---------------------|:--------------| -//! | `Z`(azerty), `W`(US) | Move forward | -//! | `S` | Move backward | -//! | `Q`(azerty), `A`(US) | Move left | +//! | `W` | Move up | +//! | `S` | Move down | +//! | `A` | Move left | //! | `D` | Move right | use bevy::core_pipeline::bloom::BloomSettings; @@ -61,7 +61,7 @@ fn setup_scene( fn setup_instructions(mut commands: Commands) { commands.spawn( TextBundle::from_section( - "Move the light with ZQSD or WASD.\nThe camera will smoothly track the light.", + "Move the light with WASD.\nThe camera will smoothly track the light.", TextStyle::default(), ) .with_style(Style { @@ -111,6 +111,10 @@ fn update_camera( } /// Update the player position with keyboard inputs. +/// Note that the approach used here is for demonstration purposes only, +/// as the point of this example is to showcase the camera tracking feature. +/// +/// A more robust solution for player movement can be found in `examples/movement/physics_in_fixed_timestep.rs`. fn move_player( mut player: Query<&mut Transform, With>, time: Res