Distance between two 3D objects' faces

Posted by Arthur Gibraltar on Game Development See other posts from Game Development or by Arthur Gibraltar
Published on 2012-07-05T22:14:02Z Indexed on 2012/07/06 3:24 UTC
Read the original article Hit count: 333

Filed under:
|

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.

© Game Development or respective owner

Related posts about XNA

Related posts about c#