tpw 2313 Posted September 27, 2010 I'm working on an enemy spawn script that announces the direction and distance to the enemy location. Distance - no problem! Direction between player and enemy position, hmmm. I guess it could be done using trigonometry from map coordinates. But I'm sure I read somewhere that there is a newish armascript command for determining the direction of one object relative to another. Can anyone help with this? Share this post Link to post Share on other sites
rundll.exe 12 Posted September 27, 2010 Fire up the function library. I believe there is some function that does exactly what you want. I cant search it for you atm, but you should be able to find it in the lib. Share this post Link to post Share on other sites
ProfTournesol 956 Posted September 27, 2010 Fire up the function library. I believe there is some function that does exactly what you want. I cant search it for you atm, but you should be able to find it in the lib. Nah, it's for ArmA2 AFAIK. Share this post Link to post Share on other sites
TRexian 0 Posted September 27, 2010 Ok, for A1, you still need some trig, but it is not too hard. I'm digging this out of an OLD script, so it may require some testing. _orig = origin position _dest = destination position The result of this formula is a direction (0-360) from the origin to the destination. _vector = ((((_dest select 0) - (_orig select 0)) atan2 ((_dest select 1) - (_orig select 1))) + 360) % 360; Now, I used to be able to explain the trig... but... not anymore. :) G'luck. Share this post Link to post Share on other sites
tpw 2313 Posted September 27, 2010 Thanks kind sir, exactly what I needed. I actually don't mind a bit of trig as long as I don't have to think too hard about it! Share this post Link to post Share on other sites