cache? acclertion 👍

main
Zynh Ludwig 2024-09-02 23:48:24 -07:00
parent b2b59d68d5
commit f6feef04e5
1 changed files with 9 additions and 9 deletions

View File

@ -20,19 +20,19 @@ struct Boid;
struct Velocity(Vec2); struct Velocity(Vec2);
#[derive(Component, Default)] #[derive(Component, Default)]
struct SeperationCache(Vec2); struct SeperationAcceleration(Vec2);
#[derive(Component, Default)] #[derive(Component, Default)]
struct CohesionCache(Vec2); struct CohesionAcceleration(Vec2);
#[derive(Component, Default)] #[derive(Component, Default)]
struct AlignmentCache(Vec2); struct AlignmentAcceleration(Vec2);
#[derive(Bundle, Default)] #[derive(Bundle, Default)]
struct BoidCacheBundle { struct BoidAccelerationBundle {
s_cache: SeperationCache, s_cache: SeperationAcceleration,
c_cache: CohesionCache, c_cache: CohesionAcceleration,
a_cache: AlignmentCache, a_cache: AlignmentAcceleration,
} }
#[derive(Bundle, Default)] #[derive(Bundle, Default)]
@ -40,10 +40,10 @@ struct BoidBundle {
mesh: MaterialMesh2dBundle<ColorMaterial>, mesh: MaterialMesh2dBundle<ColorMaterial>,
velocity: Velocity, velocity: Velocity,
boid: Boid, boid: Boid,
cache: BoidCacheBundle, cache: BoidAccelerationBundle,
} }
fn seperation(mut boids: Query<(&Transform, &mut SeperationCache), With<Boid>>) {} fn seperation(mut boids: Query<(&Transform, &mut SeperationAcceleration), With<Boid>>) {}
fn move_boids(mut boids: Query<(&mut Transform, &Velocity), With<Boid>>, time: Res<Time>) { fn move_boids(mut boids: Query<(&mut Transform, &Velocity), With<Boid>>, time: Res<Time>) {
for (mut transform, velocity) in &mut boids { for (mut transform, velocity) in &mut boids {