2021-10-16 23:06:11 +00:00
|
|
|
function math.sign(x)
|
|
|
|
if x<0 then
|
|
|
|
return -1
|
|
|
|
elseif x>0 then
|
|
|
|
return 1
|
|
|
|
else
|
|
|
|
return 0
|
|
|
|
end
|
2021-10-24 23:41:40 +00:00
|
|
|
end
|
2022-01-17 23:14:54 +00:00
|
|
|
|
|
|
|
function GetAngleFromVector(x,y)
|
|
|
|
local reduce = 0
|
|
|
|
if x < 0 then
|
|
|
|
reduce = math.rad(180)
|
|
|
|
end
|
|
|
|
return math.atan(y/x) - reduce
|
|
|
|
end
|