Shortest distance between two segments

Hey all,

I’ve been scouring the web to get the shortest distance (or rather, the two closest points) of two segments, or a segment and a ray. I came across the following url:

http://www.geometrictools.com/LibMathematics/Distance/Wm5DistSegment3Segment3.cpp

Which looks quite lengthy to translate in Python. Is there any nodePath / CollisionSolid trickery I can use to get the same effect? Or rather, does anyone have a Python implementation to achieve this calculation?

Thanks in advance! :slight_smile: