Forged Alliance Forever Forged Alliance Forever Forums 2015-01-22T16:36:07+02:00 /feed.php?f=45&t=9282 2015-01-22T16:36:07+02:00 2015-01-22T16:36:07+02:00 /viewtopic.php?t=9282&p=91898#p91898 <![CDATA[How to get North / South / East / West from a vector]]>
Feed in the x and z data from your three point vector...
Code:
local heading = math.atan2( vector[1], vector[3] )
LOG(' heading: ', heading)


A log result of:

Spoiler: show
0 = north
- values = east
+ values = west
3 = south


Hence a value of -2.4257481098175 is somewhere south / east of our target. (Relative to the map not the unit)

Note: Used the vector data from unit.lua DoTakeDamage to test this. No engineers were hurt during the testing of this script.

Resin

Statistics: Posted by Resin_Smoker — 22 Jan 2015, 16:36


]]>