From e6e56506f8785b23dbbc533b226794ed8b7b2405 Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Wed, 3 Sep 2025 14:11:18 -0500 Subject: [PATCH] Fix: `alignment` should align to vel, not impulse I need to apply an impulse to match the velocities, but the previous version was trying to match the forces. --- src/birdoids/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/birdoids/mod.rs b/src/birdoids/mod.rs index a530c203..5b84965c 100644 --- a/src/birdoids/mod.rs +++ b/src/birdoids/mod.rs @@ -256,7 +256,8 @@ fn alignment( continue; }; - force.0 = (avg.extend(0.0) - force.0) * ALIGNMENT_FACTOR; + let boid_vel = boid_velocities.get(this_entt).unwrap(); + force.0 += (avg.extend(0.0) - boid_vel.0) * ALIGNMENT_FACTOR; } }