float x = x1 - x2;
float y = y1 - y2;
float z = z1 - z2;
distance = sqrt(x*x + y*y + z*z)
float x = x1 - x2;
float y = y1 - y2;
float z = z1 - z2;
distance = sqrt(x*x + y*y + z*z)
Like (x1, y1, z1) and (x2, y2, z2).
Thanks!
i.e.: if you have two billiard balls which are 2 units in diameter, to see if they collide, you can check to see if their centers are within 4 units of each other, avoiding a square root operation.
-- Pryankster