Bounce

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.

Applied with * like any dynamics — entity *= bounce(penetration) — carrying the penetration it resolves and the velocity of the collider whose edge was violated. The default is the zero direction: a static collider.

Constructors

Link copied to clipboard
constructor(penetration: Penetration, colliderVelocity: Direction = Direction(0.0, 0.0))

Properties

Link copied to clipboard

The violated collider's velocity, in model units per second; the zero direction — a static collider — when omitted.

Link copied to clipboard

The resolved penetration — the violated edge, the depth past it, and the way out.