Isle-Slingers/js/physics/collision/agents.md

19 lines
1.1 KiB
Markdown
Raw Permalink Normal View History

# js/physics/collision/ — agents.md
Part of the modularization pass. Module map: `MODULES.md`; runtime model: `architecture.md`.
Installs into `P`: crushCircleVsBox, collideBirdWorld, collideBirdBlocks,
collideBirdEnemies, REST_VEL_CLAMP, resolveBoxPair.
- Contact resolution for circles (birds, enemies) vs axis-aligned blocks and
block-block pairs. `resolveBoxPair` is the box-box rest/impulse resolver;
`crushCircleVsBox` is the fast-falling-onto-structure damage path.
- Added 2026-09-29: `crushCircleVsBox` is velocity-direction-
aware (the box must be the body plowing into the enemy, `boxAlong > 30`; a
resting box never crushes), carries a per-enemy crush cooldown (0.12 s — one
landing = one crush instance) and an inelastic velocity transfer so boxes do
not phase through enemies; `resolveBoxPair` stacked contact is mass-weighted
inelastic (heavy blocks drive light planks — chain-crush). S-3 (topple) does
NOT live here: pivoting blocks are excluded from box-pair resolution by the
step loop and integrate in `topple/` — keep it that way.
- Consumes: MATERIALS, WORLD, damageBlock, damageEnemy.