Real World Maths Busters

The Maths Behind Everyday Life

The story, the formula and a worked example — see exactly where this maths shows up in the world around you.

Back to all stories
Games & Chance 3 min read

Hitboxes Are Simpler Than You Think

Collision detection uses rectangles.

Most video games approximate character shapes with simple rectangles (AABB) or circles for collision detection. The Pythagorean theorem handles circle-vs-circle checks.

Circle collision

Two circles collide when distance between centres < r₁ + r₂.

(x2−x1)2+(y2−y1)2<r1+r2\sqrt{(x_2-x_1)^2 + (y_2-y_1)^2} < r_1 + r_2

Player at (100,200) r=20, enemy at (130,220) r=15

  1. 1

    Distance

    √((130−100)² + (220−200)²) = √(900+400) = 36.1

  2. 2

    Sum of radii

    20+15 = 35

  3. 3

    Collision?

    36.1 > 35 → barely missed

Answer

No collision — missed by 1.1 pixels

The formula behind it

Pythagorean Theorem

a2+b2=c2a^2 + b^2 = c^2
See the full formula, variables and more examples

The takeaway

Every game hit you take — or narrowly avoid — is resolved by Pythagoras.

Back to all stories