# Distance between two 3D objects' faces

I'm really newbie on programming and I'm making some tests. I couldn't find nowhere on Internet how could I calculate the distance between two 3D objects' faces. Is there anyway?

Detailing, as an example, I have two 3D cubes. Each one has a vector3 position designating it's center on the 3D space and an orientation matrix. And each cube has a size (float width, float height and float length).

I could get a simple distance between them by calling Vector3.Distance(), but it doesn't consider its sizes, just the position. Then the distance would be between its centers.

Is there any way to calculate the distance between the faces? Thanks for any reply.

-
I'm now trying to use a sphere created with ray equal to object's biggest dimension, for each object. And I would just have to remove the ray from the distance calculated from Vector3.Distance(). But seems to not work on large objects since spheres may get wrongly intersected. And maybe not the entire object may get inside the sphere. What would be the best way to calculate the distance? – Arthur Gibraltar Jul 5 '12 at 22:39
In "ray", mean "radius". – Arthur Gibraltar Jul 5 '12 at 22:58