24 lines
1.5 KiB
Markdown
24 lines
1.5 KiB
Markdown
|
|
# js/physics/topple/ — agents.md
|
||
|
|
RC-375D84 S-3 (2026-09-29). Module map: `MODULES.md`; runtime model: `architecture.md`.
|
||
|
|
|
||
|
|
Installs into `P`: toppleBlocks, blockSupportSpan, beginTopple, integrateTopple,
|
||
|
|
landTopple, topplePathDamage, settleBack, supportStillAlive.
|
||
|
|
|
||
|
|
- Owns the board tip/topple behavior (Q1: FULL CONTINUOUS ROTATION). A resting
|
||
|
|
block whose COM lies past the x-span of its support (ground or the top face of
|
||
|
|
a block below, via `blockSupportSpan`) pivots about the support-edge corner
|
||
|
|
under gravity (point-mass COM, `alpha = G*(comX-pivotX)/r^2`).
|
||
|
|
- Two endings: (a) a far corner reaches the ground line -> `landTopple`
|
||
|
|
(impact speed = |angVel|*r, self-damage + `topplePathDamage` on the footprint:
|
||
|
|
blocks take impact, enemies in the footprint can be killed through the normal
|
||
|
|
crush curve); (b) the pivot is too high for any end to reach the ground ->
|
||
|
|
the board is a pendulum and `settleBack` returns it flat to its rest position.
|
||
|
|
- Anti-livelock: a swung-and-settled board is marked `toppled` and only re-tips
|
||
|
|
on a real knock (displacement >= 6px) or a damaging hit (`damageBlock` clears
|
||
|
|
the mark). Do NOT re-arm on velocity alone -- the pendulum's own swing-back
|
||
|
|
speed defeats that (regression: test/knifeedge.test.mjs).
|
||
|
|
- A pivoting block is EXCLUDED from linear integration, box-pair resolution and
|
||
|
|
crush in `step` -- those loops must keep skipping `bl.pivoting`.
|
||
|
|
- Consumes: WORLD, GRAVITY, REST_SPEED, MATERIALS, ENEMY_TYPES, damageBlock,
|
||
|
|
damageEnemy. Tests: test/topple.test.mjs (5 arms), test/knifeedge.test.mjs (6 arms).
|