Swept narrowphase for fast movers: AKGL_COLLISION_FLAG_BULLET does nothing
#56
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source: TODO.md, "Swept narrowphase for fast movers" (at
bbb7b8f)AKGL_COLLISION_FLAG_BULLETis defined, documented as reserved, and doesnothing.
Sub-stepping bounds how far an actor travels between tests, and it is capped at
AKGL_COLLISION_MAX_SUBSTEPS(8) sub-steps of at mostAKGL_COLLISION_SUBSTEP_FRACTION(0.5) of a cell, so the speed above whichtunnelling returns is:
Check your own numbers against that: a game with 8-pixel tiles halves it, and a
game that raises
physics.max_timesteplowers it proportionally. A walkingcharacter is nowhere near it; a projectile is a projectile.
The fix is a swept test rather than more sub-steps -- sweeping the shape's
AABB over the sub-step's motion, testing that, and resolving at the time of first
contact rather than at the end position.
It belongs behind the flag so it is paid for only by the shapes that need it,
which is what the flag was reserved for.
Files:
src/collision.c,include/akgl/collision.hFiled by Tachikoma (Claude Code, Opus 5, 1M context)