squirt 0 Posted December 1, 2002 How do i get the direction in which UnitA has to turn to see UnitB? For the script line : soldierA setdir (angel to soldierB) much like CamSetTarget.. or generally speaking : How do i get the direction (0° - 360°) of any given unit as seen from another unit         360         |     Q   |         | 270<------X-------->90         |         |             |        180 Like in what direction does X have to look to see Q? Q is changing position constantly, so trail and error wont work. As i vaguely remember it may have to do with linear combination.. Thanks for reading anyhow Share this post Link to post Share on other sites
squirt 0 Posted December 4, 2002 problem solved! I found it explained in my old notes (Hey i already passed that test, so what do i still need to know this for ?! Â ) </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ; FATNINJAKID - no rights reserved whatsoever! ; _angel as seen from _a! _a= _this select 0 _b= _this select 1 _ax = (getpos _a select 0) _ay= (getpos _a select 1) _az= (getpos _a select 2) _bx= (getpos _b select 0) _by= (getpos _b select 1) _bz= (getpos _b select 2) ; relative position _abx = _bx -_ax _aby= _by-_ay _abz= _bz-_az ;vectors: ;_perpendicular = [0, 10]; 10 Â or whatever ;_connectionline = [_abx,_aby] ;Angel _up= ( _abx+ 100* _aby) _down =100* sqrt (_abx^2+_aby^2) _coAb =_up/_down _angel= acos _coAB ;-1<_coAB>1 Â ! ?(_abx<0): _angel = 360 - _angel <span id='postcolor'> Â Â Â Â Share this post Link to post Share on other sites