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().

Today we talk about intersections.

Probably from now on things will get slightly complicated, but as always, when we know what to do and how to do it, the real difficulty lies in understanding the formulas and translating them into the code.

First of all, what is an intersection?
In a…

Now that we have our method, let’s try applying it to our three cubes!

First of all, we need another script to create the plan.
I called it CreatePlane.
Inside, we first of all take the reference of the three cubes and the plane.

So, what we need to create…

While the line is represented by a point and a Vector, the plane is represented by a point and two Vectors.

If for example we have a Point A and two Vectors, v and u, to find the Point B in any point of the plane is

B = A + v*s + u*t

Now, the parametric…

Matteo Lo Piccolo

Always in love with programming, even if late (I'm already 39 years old) I decided to follow my dream! We will see how far my passion will take me!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store