3D Distance Calculator
Distance, midpoint and direction between two points in 3D space.
The 3D distance formula
d = √((x₂-x₁)² + (y₂-y₁)² + (z₂-z₁)²)
The Pythagorean theorem applied twice. Points (0,0,0) and (3,4,12) are exactly 13 apart, a member of the 3-4-12-13 quadruple.
In game code, compare squared distances
The square root is the expensive part and usually unnecessary: to test 'within 10 units', compare the squared distance against 100. Engines expose sqrMagnitude / SizeSquared precisely for this. Take the real root only when you need the actual length, like normalizing the direction vector shown here.