NavMeshAvoidance.cs: after all agents step, overlapping agents are pushed apart along the navmesh (a few relaxation passes), then each agent picks its next velocity by adaptive sampling around its preferred one (toward the path's corner at full speed, or braking): rings of candidate directions refined around the best, scored by distance from the preferred and current velocities, time to the first collision with a neighbor or obstacle within a look-ahead, and a passing-side bias. The side is chosen from geometry (away from where the neighbor is off the heading, keeping right when it is dead ahead), so both agents agree and keep to it. Quality levels set the sample counts.- Priority as Unity's: an agent ignores less important agents (higher avoidancePriority) and isn't pushed by them; equals share the work (reciprocal). NoObstacleAvoidance agents pass through others. Idle agents run avoidance aiming to stand still, so they step aside. NavMeshObstacles (not carving) are avoided as circles.
- The
navigation_avoidancescenario (head-on, four crossing, through an idle agent, no avoidance, priorities, an obstacle) matches Unity's outcomes: closest approach at contact, sideways deviations within a few centimeters (head-on 0.505 vs 0.509, obstacle 1.253 vs 1.262), arrival, priorities; 47 scenarios pass. Anavigation_crowdsample (sixteen agents swapping across a circle, four of them more important). - Differences: Unity's walker nudges an idle agent on contact and slows more (ours goes around it); navmesh walls aren't part of the velocity choice; box obstacles are circles.
- Next: Sprite (cookie) lights and soft 2D shadows.
Phase 5 · Slice 25 ·