From ed7b947f1268a6603c5a25225009c156906b2842 Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Sat, 25 Nov 2023 13:41:58 -0800 Subject: [PATCH] avoid the ground --- src/lib.rs | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 76032ef..b583547 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,10 +1,14 @@ use argh::FromArgs; use bevy::prelude::*; +// toid const SPEED: f32 = 1.0; const SPEED_DIFF_RANGE: f32 = 0.08; // +/- 8% -const RADIUS: f32 = 1_000.0; +// how far from origin before really wanting to come back +const RADIUS: f32 = 100.0; + +const MIN_ALTITUDE: f32 = 1.5; pub type Point = [f32; 3]; pub type Toint = rstar::primitives::GeomWithData; @@ -20,11 +24,8 @@ pub struct Config { #[derive(Resource, Deref, DerefMut, Default)] pub struct Index(pub rstar::RTree); -#[derive(Resource, Deref, DerefMut, Default)] -pub struct Positions(pub std::collections::HashMap); - #[derive(Component, Debug, Clone, Deref, DerefMut, Default)] -pub struct Buddies(Vec); +pub struct Buddies(Vec); #[derive(Component, Debug, Clone, Deref, DerefMut, Default)] pub struct Velocity(Vec3); @@ -72,14 +73,20 @@ pub fn add_gizmos(mut gizmos: Gizmos, toids: Query<(&Transform, Entity), With, time: Res