Math in Unity : Dot Product (Part II)

we will take the x of v and we will multiply it by the x of w, same thing with the y, so vy * wy, and we will add them.

Angle = inverse cosine of the DotProduct divided by the length of the Vector v multiplied by the length of the Vector w.

we calculate the Dot between the two Vectors v and w.

The Dot product of v and w

Next we divide by the length of v and w multiplied by each other.

Acos() needs a float and we can pass dotDivision as a parameter.

--

--

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