Hey^^
I somewhat got a problem with finding the correct angle between 2 points, I took a look at the bj fucntion and saw the Atan2 thing, so I thought i would just do the same and use coordinates.
However somehow i cant get it to work, the angles go from 0° - 90° and then go back to 0°
somewhat like this:
-------- 90°
---- 0° ------- 0°
-------- 90°
heres the code:
Its probably just some stupid error made by me ...
I somewhat got a problem with finding the correct angle between 2 points, I took a look at the bj fucntion and saw the Atan2 thing, so I thought i would just do the same and use coordinates.
However somehow i cant get it to work, the angles go from 0° - 90° and then go back to 0°
somewhat like this:
-------- 90°
---- 0° ------- 0°
-------- 90°
heres the code:
JASS:
private function Orders takes nothing returns boolean
local unit u = GetTriggerUnit()
local real dx
local real dy
local Squad squad = Squad<u>
if GetIssuedOrderId() == OrderId("move") or GetIssuedOrderId() == OrderId("patrol") or GetIssuedOrderId() == OrderId("smart") then
set TempInt = GetIssuedOrderId()
set TempX = GetOrderPointX()
set TempY = GetOrderPointY()
set dx = TempX - GetUnitX(u)
set dy = TempY - GetUnitY(u)
set TempAngle = Atan2(dy * dy, dx * dx) // here lies the error i think
call BJDebugMsg("Atan2 :" + R2S(bj_RADTODEG * Atan2(dy * dy, dx * dx)))
//call ForGroup(squad.members, function MoveOrder)
endif
set u = null
return false
endfunction</u>
Its probably just some stupid error made by me ...