Mothback/data/scripts/math.lua

18 lines
251 B
Lua

function math.sign(x)
if x<0 then
return -1
elseif x>0 then
return 1
else
return 0
end
end
function GetAngleFromVector(x,y)
local reduce = 0
if x < 0 then
reduce = math.rad(180)
end
return math.atan(y/x) - reduce
end