From 2049fbcc005c161250a94c9b0b73566a54a6323a Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Sun, 26 Nov 2023 15:12:57 -0800 Subject: [PATCH] don't change velocity too suddenly --- src/lib.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 4047db5..aace608 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,6 +7,7 @@ pub type NNTree = KDTree3; // toid const SPEED: f32 = 5.0; const SPEED_DIFF_RANGE: f32 = 0.1; // +/- 8% +const MAX_DELTA_V: f32 = std::f32::consts::PI * 2.0; // basically 360 degrees/sec // how far from origin before really wanting to come back const RADIUS: f32 = 400.0; @@ -73,9 +74,12 @@ pub fn turkey_time( pub fn update_vel( mut toids: Query<(&Transform, &mut Velocity, &Toid, &Buddies, Entity)>, + time: Res