Labs · Vectors

Reflection off Walls

Reflection off Walls simulation

The dot product in action. When a ball hits a wall with unit normal n, its velocity reflects:

v′ = v − (1 + e)(v · n) n

v · n measures how much of the velocity points into the wall. Only that component is flipped (and scaled by the bounciness e), and the part along the wall is untouched. With "Show vectors" on, every hit flashes the incoming velocity (pink), the normal (yellow) and the outgoing velocity (green).

Drag to draw your own walls. Right-click a wall to delete it. Try building a funnel.

Controls

Evolved from Vector Math Playground.

Evolved into Laser & Mirrors (Ray Tracing).