Antares
Spell Reviewer
- Joined
- Dec 13, 2009
- Messages
- 982
Your method of determining the turn direction fails at the 360° - 0° transition point.
You can use this function to determine the sign of the angle difference:
You can use this function to determine the sign of the angle difference:
JASS:
function AngleBetweenAngles takes real a, real b returns real
set b = b - a
if b < 0 then
set b = b + 2*bj_PI
elseif b > 2*bj_PI then
set b = b - 2*bj_PI
endif
if b > bj_PI then
return b - 2*bj_PI //less than 0.
else
return 2*bj_PI - b //greater than 0.
endif
endfunction
Last edited: