Math for Game Development

Collision detection, linear interpolation, easing, Bézier curves, projectile paths, reflection and pseudo-random numbers — calculations games use every frame.

Formula
Rectangle Collision (AABB)
Checks whether two unrotated rectangles overlap with four comparisons.
A.x < B.x + B.w and B.x < A.x + A.w and A.y < B.y + B.h and B.y < A.y + A.h
Circle Collision
Two circles overlap when the distance between centres is at most the sum of the radii.
(x₂ − x₁)² + (y₂ − y₁)² ≤ (r₁ + r₂)²
Linear Interpolation (lerp)
The value part of the way from a to b, where t runs from 0 to 1.
lerp(a, b, t) = a + (b − a) t
Easing Functions
Functions that bend the progress of time from 0 to 1 so motion starts or stops gently.
smoothstep(t) = t²(3 − 2t)  easeInQuad(t) = t²
Cubic Bézier Curves
A smooth curve defined by four control points.
B(t) = (1−t)³P₀ + 3(1−t)²t P₁ + 3(1−t)t² P₂ + t³P₃
Projectile Path
Without air resistance, a thrown object flies along a parabola.
range R = v² sin 2θ ÷ g  peak H = (v sin θ)² ÷ 2g
Reflection Vector
The direction after something moving along d bounces off a surface with unit normal n.
r = d − 2(d · n)n
Pseudo-Random Numbers (xorshift)
Shifting bits and XOR-ing them produces a stream of numbers that look random.
x ^= x << 13; x ^= x >> 17; x ^= x << 5

Math Formula Quiz All formulas

Sources

Checked: 2026-11-29