From 5158fba63bccf050103362f029e22d75988d0208 Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Wed, 27 Nov 2024 13:40:01 -0800 Subject: [PATCH] use parallel iter to update velocities --- assets/models/toid3.glb | Bin 0 -> 2156 bytes src/lib.rs | 151 ++++++++++++++++++++++------------------ src/main.rs | 4 +- 3 files changed, 86 insertions(+), 69 deletions(-) create mode 100644 assets/models/toid3.glb diff --git a/assets/models/toid3.glb b/assets/models/toid3.glb new file mode 100644 index 0000000000000000000000000000000000000000..95b872d8c86632f5f35010d345ca23a7a8278614 GIT binary patch literal 2156 zcmb7GZEO=|9Dig?Cn!kdC4SN63Fwqk@2%In+xlF$I%IQeNn6=i1?k#bchKIE>uoq@ zWg$q6M$q{30ZsgX8iOww0a;eKQxf?gXe0p?!v~FMmY@VQ!>RM-f7iXqTpUT$=l6eq z{=fhKX`0E#SI$BRWh)T!lq1v_i-db|GM`sWEcN1yqA5nw)D0}*hdK>i)AN-X2&t^g zDq31GDjV*PRCcpo&g-MF2X`w*Uez^lX1o+GcyK-i39v+sqCA!oy;w`;K!;P ztvCj1U18mX)QfXUzS9jI^*41jjUAU<(o_sJnJr~Y>s{?xC8nm8G?q-GOMx7v0?ng- zUW%gOa+}+YX2ncqvuY};cV#*?B@Y>TaeFeag!HU#tW2idP7{<9!3usxWH^fPi#*5q zS&yToe7v9H{4^j=@X-w8Xc>X#c#egS>&kg(=aQqP#*zXB##q&Ho!3`z8-h+<3dXq! z=|CG?*-&$;sdkSVlcs5??OmoL_Ttr%SVO!a5_UO?*SCfuk>~@DQdpurI2?&K*EV5^ z@!)uE_`&*c97`8gdR(ErjCLoOW z9t+hr)kfWiGSU6yk-Fn-?=h7oMa!7*#Ap$Ea}<$|4)@)|u9`_B{F-)E)_qT*R*nHKZ`)MolXF~okcGVI-r>(bt zPsn{=3`xt@Z?j)Lu{(e|f0d$u&m0E4l?@%2v|$*Lc> z+QC^Di}+Y0=?DDL$-!dP$BpD9;GxW5@e}Zg1J<5vu?yw^*;+hd0cY~*P{Lk(a1VJ= zKI_WQ)~vG)Wd~XH$9YG#dsa8u-`;yqVCjWB98ToW#;`5dP)E0yFR>lD<*#k_g7*## zbRW1-?fA1h*V?; // 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