Game Designer & Developer


Game Dev

Angle


Calculate the angle between two vectors using ArcCos or Diamond Angle

A×B=A×B×sinθ×N^\vec{A}\times\vec{B} = \|\vec{A}\|\times\|\vec{B}\|\times\sin\theta\times\widehat{\vec{N}}
Where N\vec{N} is perpendicular to the A\vec{A}, B\vec{B} plane.

AB=A×B×cosθ\vec{A}\cdot\vec{B} = \|\vec{A}\|\times\|\vec{B}\|\times\cos\theta
A[x1,y1]B[x2,y2]=x1×x2+y1×y2\vec{A}[x_{_1}, y_{_1}]\cdot …

This will calculate the clockwise or anti-clockwise angle (depending on coordinate system chirality) of a vector in a range of 00 to 44 where each whole unit is equal to 90°90\degree.