How Restitution 1.0 Behaves in Matter.js

In Matter.js, the restitution property dictates the elasticity or bounciness of a rigid body during impacts. Assigning a restitution value of 1.0 defines a perfectly elastic collision, theoretically conserving 100% of the body's kinetic energy when it strikes another surface. This article explains how the 1.0 restitution value interacts with other physics bodies in the engine, why external factors like friction affect the outcome, and how to achieve true perpetual bouncing.

Collision Resolution Logic

Matter.js determines collision elasticity using the higher restitution value between two colliding bodies. By default, the engine applies Math.max(bodyA.restitution, bodyB.restitution) to compute the collision response. Because of this formula:

The Impact of Default Drag and Friction

A common misconception is that a restitution of 1.0 will cause an object to bounce indefinitely under standard engine settings. While the collision itself does not absorb kinetic energy, Matter.js bodies include default values for drag and surface friction that bleed energy continuously:

To achieve an object that bounces perpetually without losing height or speed, these properties must be explicitly disabled:

const bouncer = Bodies.circle(x, y, radius, {
    restitution: 1.0,
    friction: 0,
    frictionAir: 0,
    frictionStatic: 0
});

Numerical Stability and Edge Cases

Because Matter.js is an iterative, discrete-time physics engine, minor anomalies can occur when restitution is set to 1.0:

A restitution value of 1.0 is most commonly utilized in arcade-style mechanics, such as Pong or Breakout clones, pinball bumpers, and elastic particle simulations where realistic energy dampening is undesirable.