Math in Unity : Intersections (Part IV)

Now that we’ve calculated the intersection point, what we need is visual feedback.

In the DrawIntersection script, under the Two Lines, we try to instantiate a sphere at the exact point of the intersection of the two lines.

To do this, we create a float variable and call it
intersectT = to our IntersectionPoint() method and pass the second line as a parameter.

To finish it, we need another method that we have already used in previous articles : LERP().

Now that we have everything set up, we just have to do a test.

And as we can see, the sphere is exactly at the intersection of the two lines.

Feel free to change coordinates and do other tests!