From 18885d9b94dc3744739162bd77e766fb23adc74f Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Fri, 12 Jul 2024 16:47:27 -0500 Subject: [PATCH] Rename Acceleration to Force Closes #2 Acceleration is mass * force. This doesn't materially change anything, but it will make it easier to give the boids a mass component. The change will not require updates to most of the systems, only the physics integrator and the boids bundle. --- src/birdoids_plugin.rs | 20 ++++++++++---------- src/debug_plugin.rs | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/birdoids_plugin.rs b/src/birdoids_plugin.rs index 242e24fd..3fa129e0 100644 --- a/src/birdoids_plugin.rs +++ b/src/birdoids_plugin.rs @@ -52,7 +52,7 @@ struct PlayerBoid; pub(crate) struct Velocity(Vec3); #[derive(Component, Deref, DerefMut)] -pub(crate) struct Acceleration(Vec3); +pub(crate) struct Force(Vec3); #[derive(Component)] pub(crate) struct TrackedByKdTree; @@ -61,7 +61,7 @@ pub(crate) struct TrackedByKdTree; struct BoidBundle { boid: Boid, velocity: Velocity, - accel: Acceleration, + accel: Force, spatial: TrackedByKdTree, } @@ -70,7 +70,7 @@ impl BoidBundle { Self { boid: Boid, velocity: Velocity(vel), - accel: Acceleration(Vec3::ZERO), + accel: Force(Vec3::ZERO), spatial: TrackedByKdTree, } } @@ -114,7 +114,7 @@ fn spawn_boids( )); } -fn space_brakes(mut mobs: Query<&mut Acceleration, With>) { +fn space_brakes(mut mobs: Query<&mut Force, With>) { for mut accel in &mut mobs { let braking_dir = -accel.0 * SPACEBRAKES_COEFFICIENT; accel.0 += braking_dir; @@ -147,7 +147,7 @@ fn turn_if_edge( } fn apply_velocity( - mut query: Query<(&mut Transform, &Velocity, &mut Acceleration)>, + mut query: Query<(&mut Transform, &Velocity, &mut Force)>, time: Res