Here is a function I use. you can put at the top
int getdistance (int object)
{
double x_dif = 0;double y_dif = 0; double z_dif = 0; double dist_squared = 0;
x_dif = dbCameraPositionX() - dbObjectPositionX(object);
y_dif = dbCameraPositionY() - dbObjectPositionY(object);
z_dif = dbCameraPositionZ() - dbObjectPositionZ(object);
dist_squared = x_dif*x_dif + y_dif*y_dif + z_dif*z_dif;
return dbSQRT (dist_squared);
}
example to use it:
getdistance(2);
this will return the distance between the default camera and object number 2.
havnt tested it.