Math in Unity : Planes (Part II)

Matteo Lo Piccolo
2 min readNov 8, 2021

--

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 an “illusory” Plane is a double loop, based on our parameters s and t.

To see this “illusion”, we instantiate some cubes to see the result of our “Plane”.

What we do in this nested loop is to create a plane based on s and t, after which we instantiate some cubes to “test” the plane formula.

Now that we’re ready for testing, let’s create an empty GameObject, name it whatever you like, and attach the script to it.

As you can see I have set the Cube A as the point of origin, and AB / AC as the Vectors.

And if we press Play now

We have our Plane!

One important thing is that the plan is technically like a line, so it goes on forever.
To demonstrate this, just change the values of s and t.

Our Plane now continues beyond our “limits”.

In the next articles we will see other very interesting things!

--

--

Matteo Lo Piccolo
Matteo Lo Piccolo

Written by 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!

No responses yet