fix: compare next vs current occupancy counts instead of absolute threshold

Two entities on the same tile (16,-0.0) each saw count=2 and blocked each
other with occupied=true since 2>1. The collision check was treating the
entity's own presence as a blocker.

Now: only trigger avoidance when next_tile has strictly more entities than
current_tile. Handles path[0]=current_pos (count equal → move), two entities
passing through same tile (counts stay equal → move), and genuinely crowded
destinations (next has more → dodge). Also raise crowded threshold to 4+.
This commit is contained in:
2026-03-21 10:35:35 +00:00
parent 31516f5c58
commit f0cb86e73c
+4 -2
View File
@@ -596,8 +596,10 @@ pub fn movement(
if ambulatory.path_index < path.len() {
let next_point = path[ambulatory.path_index];
let current_crowded = occupancy.count_at(transform.translation) > 2;
let occupied = !current_crowded && occupancy.count_at(next_point) > 1;
let current_count = occupancy.count_at(transform.translation);
let next_count = occupancy.count_at(next_point);
let current_crowded = current_count > 3;
let occupied = !current_crowded && next_count > current_count;
if occupied {
let move_dir = next_point - transform.translation;
if move_dir.length_squared() > 0.0 {