Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to calculate the distance between a Vector3 and a (3D polygon triangle)?

for example : " float DistanceToTrianale( Vector3 pos, Vector3 Edges1, Vector3 Edges2, Vector3 Edges3)

thanks in advance

share|improve this question
Distance to where? The center of the triangle? – bummzack Mar 29 '13 at 17:49
I say this not having easy access to it where I'm at right now, but have a copy of on hand or you're doing life wrong. The answer boils down to using Voronoi regions and easy math, all explained in detail in that book. – Sean Middleditch Mar 29 '13 at 21:17
bummzack - the Distance the nearest point in the triangle – Johan Polson Mar 30 '13 at 0:26
up vote 1 down vote accepted

Here is a nice guide to the problem, with implementation:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.