diff --git a/examples/transforms/align.rs b/examples/transforms/align.rs index 681523b1be..1e84ca38c3 100644 --- a/examples/transforms/align.rs +++ b/examples/transforms/align.rs @@ -2,6 +2,7 @@ use bevy::color::palettes::basic::{GRAY, RED, WHITE}; use bevy::input::mouse::{AccumulatedMouseMotion, MouseButtonInput}; +use bevy::math::StableInterpolate; use bevy::prelude::*; use rand::{Rng, SeedableRng}; use rand_chacha::ChaCha8Rng; @@ -18,15 +19,9 @@ fn main() { /// This struct stores metadata for a single rotational move of the ship #[derive(Component, Default)] struct Ship { - /// The initial transform of the ship move, the starting point of interpolation - initial_transform: Transform, - /// The target transform of the ship move, the endpoint of interpolation target_transform: Transform, - /// The progress of the ship move in percentage points - progress: u16, - /// Whether the ship is currently in motion; allows motion to be paused in_motion: bool, } @@ -92,7 +87,6 @@ fn setup( ..default() }, Ship { - initial_transform: Transform::IDENTITY, target_transform: random_axes_target_alignment(&RandomAxes(first, second)), ..default() }, @@ -147,37 +141,33 @@ fn draw_random_axes(mut gizmos: Gizmos, query: Query<&RandomAxes>) { } // Actually update the ship's transform according to its initial source and target -fn rotate_ship(mut ship: Query<(&mut Ship, &mut Transform)>) { +fn rotate_ship(mut ship: Query<(&mut Ship, &mut Transform)>, time: Res