seperation was actually cohesion the whole time

This commit is contained in:
Zynh Ludwig 2024-09-03 20:40:47 -07:00
parent b0a1676fd2
commit 4317ccf3a3

View file

@ -86,12 +86,6 @@ fn build_local_cache(
fn cohesion( fn cohesion(
mut boids: Query<(&Transform, &LocalCache, &mut CohesionAcceleration), With<Boid>>, mut boids: Query<(&Transform, &LocalCache, &mut CohesionAcceleration), With<Boid>>,
other_boids: Query<&Transform, With<Boid>>, other_boids: Query<&Transform, With<Boid>>,
) {
}
fn seperation(
mut boids: Query<(&Transform, &LocalCache, &mut SeperationAcceleration), With<Boid>>,
other_boids: Query<&Transform, With<Boid>>,
) { ) {
boids boids
.par_iter_mut() .par_iter_mut()
@ -106,10 +100,16 @@ fn seperation(
} }
accel.0 /= count as f32; accel.0 /= count as f32;
accel.0 = transform.translation.xy() - accel.0; accel.0 -= transform.translation.xy();
}) })
} }
fn seperation(
mut boids: Query<(&Transform, &LocalCache, &mut SeperationAcceleration), With<Boid>>,
other_boids: Query<&Transform, With<Boid>>,
) {
}
fn alignment( fn alignment(
mut boids: Query<(&Velocity, &LocalCache, &mut AlignmentAcceleration), With<Boid>>, mut boids: Query<(&Velocity, &LocalCache, &mut AlignmentAcceleration), With<Boid>>,
other_boids: Query<&Velocity, With<Boid>>, other_boids: Query<&Velocity, With<Boid>>,