Hello guys.
I’m trying to find the closest point between 2 lines in 3D space.
These lines are defined by two Vector3 points, for each line ofcorse (instead of the usual one Vector3 point in the line and another Vector3 as the line direction). Although each line is defined by two Vector3, you can treat them as infinite, it makes no difference.
In the attached image you can see that I have 2 lines in 3D space that almost touch each other. I need to calculate the two points (C1 and C2) where the 2 lines are the closest to each other. Both C1 and C2 need to be Vec3 as well.
It will be better for you to read and listen to the explanations for this problem that are already out there, than me trying to remember how this works, I think.
Here is a written proof, and here is a video that both explain approaches to solving this problem.