Package-level declarations

The dynamics tier: a versor acts on shapes, a dynamics acts on entities. A dynamics is a stateless value applied to one entity with * — entity *= bounce(penetration) — performing a universal response every game would otherwise hand-roll, and demanding the entity's traits through its operator's generic bounds, so a missing trait is a compile error. Each dynamics is built by a lowercase-verb factory, and the moved entity comes back as its own class through its copy hook. Bounce is the first resident, resolving a Penetration as a perfectly elastic reflection.

Types

Link copied to clipboard
class Bounce(val penetration: Penetration, val colliderVelocity: Direction = Direction(0.0, 0.0))

One bounce: the dynamics resolving a Penetration as a perfectly elastic reflection off the violated edge, relative to that edge's own motion.

Functions

Link copied to clipboard
fun bounce(penetration: Penetration, colliderVelocity: Direction = Direction(0.0, 0.0)): Bounce

Returns the Bounce resolving penetration against a collider moving at colliderVelocity.

Link copied to clipboard
operator fun <E : Shape, Kinetic> E.times(bounce: Bounce): E

Shape * Bounce => Shape
Returns this entity bounced off the violated edge: velocity reflected when the entity approaches the edge, geometry landed clear of the penetration either way.