diff --git a/assets/models/toid3.glb b/assets/models/toid3.glb new file mode 100644 index 0000000..95b872d Binary files /dev/null and b/assets/models/toid3.glb differ diff --git a/src/lib.rs b/src/lib.rs index 14053eb..7e901c4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,7 @@ use argh::FromArgs; use bevy::{ prelude::*, + tasks::ParallelIterator, utils::{HashMap, HashSet}, }; use bevy_spatial::{kdtree::KDTree3, SpatialAccess}; @@ -8,7 +9,7 @@ use bevy_spatial::{kdtree::KDTree3, SpatialAccess}; pub type NNTree = KDTree3; // toid stuff -const SPEED: f32 = 10.0; +const SPEED: f32 = 15.0; const SPEED_DIFF_RANGE: f32 = 0.1; // +/- 10% const MAX_DELTA_V: f32 = std::f32::consts::PI * 2.0; // basically 360 degrees/sec @@ -16,9 +17,9 @@ const MAX_DELTA_V: f32 = std::f32::consts::PI * 2.0; // basically 360 degrees/se const RADIUS: f32 = 50.0; // how close to try to stay to your buddies -const BUDDY_RADIUS: f32 = 10.0; +const BUDDY_RADIUS: f32 = SPEED; -const MIN_ALTITUDE: f32 = 3.5; +const MIN_ALTITUDE: f32 = 13.5; #[derive(Debug, FromArgs, Resource)] /// Toid Watching @@ -43,6 +44,9 @@ pub struct Toid { pub buddies: usize, } +#[derive(Resource, Debug, Deref, DerefMut, Clone, Default)] +pub struct Paused(bool); + #[derive(Debug, Default, Clone, Copy, Deref, DerefMut, Resource)] pub struct LookAt(Vec3); @@ -60,7 +64,6 @@ pub fn turkey_time( let y = r.gen_range(0.1..=5.5); let pos = Vec3::new(x, MIN_ALTITUDE + y, z); let xform = Transform::from_translation(pos); - //dbg!(xform); let spatial_bundle = (xform, Visibility::Visible); commands .spawn(spatial_bundle) @@ -68,10 +71,6 @@ pub fn turkey_time( .with_children(|t| { t.spawn(SceneRoot(scene.to_owned())) .insert(Transform::default()); - // .insert(Transform::from_rotation(Quat::from_axis_angle( - // Vec3::Y, - // -std::f32::consts::FRAC_PI_2, - // ))); }) .id() } @@ -81,72 +80,79 @@ pub fn update_vel( time: Res