From b2b59d68d5b86cb4c78f80e1a5e3860ab140c7ba Mon Sep 17 00:00:00 2001 From: Zynh Ludwig Date: Mon, 2 Sep 2024 21:40:11 -0700 Subject: [PATCH] cohesion scaffold --- src/main.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main.rs b/src/main.rs index 6c2c357..6d75746 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,13 +19,32 @@ struct Boid; #[derive(Component, Default)] struct Velocity(Vec2); +#[derive(Component, Default)] +struct SeperationCache(Vec2); + +#[derive(Component, Default)] +struct CohesionCache(Vec2); + +#[derive(Component, Default)] +struct AlignmentCache(Vec2); + +#[derive(Bundle, Default)] +struct BoidCacheBundle { + s_cache: SeperationCache, + c_cache: CohesionCache, + a_cache: AlignmentCache, +} + #[derive(Bundle, Default)] struct BoidBundle { mesh: MaterialMesh2dBundle, velocity: Velocity, boid: Boid, + cache: BoidCacheBundle, } +fn seperation(mut boids: Query<(&Transform, &mut SeperationCache), With>) {} + fn move_boids(mut boids: Query<(&mut Transform, &Velocity), With>, time: Res