Math Question

cleeezzz

The Undead Ranger.
Reaction score
268
you have to convert the facing to radians first, i believe.

Deg2Rad(GetUnitFacing(etc....

and yes, for offset (setting distance from point to angle)

set x = x + DISTANCE * Cos(rad)
set y = y + DISTANCE * Sin(rad)
 

ZakkWylde-

New Member
Reaction score
14
Just a helping pointer ...

when you convert a value from degree to radian, instead of 360 degrees, it is 2pi ... so 180 degrees = 1 pi.

and cos is the x value; sin is the y value. Offseting something's cos by 13 = setting it 13 to the right...

offsetting sin by -13 = setting it 13 down.

so if your unit was at the origin (0,0), it'd now be at (13, -13)

as a note: I'm not too pro at JASS, but I know math fairly well, so some of the terms I used may not be exactly correct, but I hope you can understand them :D
 

uberfoop

~=Admiral Stukov=~
Reaction score
177
but I know math fairly well, so some of the terms I used may not be exactly correct, but I hope you can understand them :D
Disagreed. Sines and cosines are not absolute values. You don't 'offset a sin by 13 to move a unit 13 up'. You offset a y coordinate by 13 to do that. Sines and cosines are ratios.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top