Code: Select all
float x,z, dx, dz, distance;
x = selectedSceneNode->getPosition().X;
z = selectedSceneNode->getPosition().Z;
dx = (camera->getPosition().X > x) ? camera->getPosition().X - x : x - camera->getPosition().X;
dz = (camera->getPosition().Z > z) ? camera->getPosition().Z - z : z - camera->getPosition().Z;
cout << "Distance: " << sqrt (dx + dz) << endl;