How can I find the clockwise angle between one vector and another

Need to find a way to calculate the clockwise angle between one vector and another. How would I do this with, say, vector A being where the angle begins and vector B being where it stops?


This should work

local a = --first
local b = --second

local plane = a:Cross(b):Cross(,1,0))

local ax, ay = a:Dot(plane), a.Y
local bx, by = b:Dot(plane), x.Y

local angle = (math.atan2(b.y, b.x) - math.atan2(a.y, a.x)) % (2 * math.pi)

This is assuming you want an upwards facing angle which makes the math more friendly and usually makes sense in a world with gravity

Also clockwise is entirely arbitrary in this case, two vectors looked at from one side looks clockwise, but from the other angle it looks counter-clockwise
(think about looking at a rotating clock with x-ray vision from the back side, the hand would be rotating counter-clockwise, clockwise is 2D concept)

If you want to switch the rotation, just change

local plane = a:Cross(b):Cross(,1,0))


local plane =,1,0):Cross(a:Cross(b))
1 Like