Angle Problem

DonRoman

New Member
Reaction score
5
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:
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(&quot;move&quot;) or GetIssuedOrderId() == OrderId(&quot;patrol&quot;) or GetIssuedOrderId() == OrderId(&quot;smart&quot;) 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(&quot;Atan2 :&quot; + 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 ... :(
 

Exide

I am amazingly focused right now!
Reaction score
448
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top