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.

A⃗⋅B⃗=∥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.