• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Does an angle between value and value exist?

Status
Not open for further replies.
So there's the known function angle between points, but is there any way to turn it into angle between GetUnitX/Y and another units X/Y?

Edit: Solved it myself, my bad.
[jass=]
function AngleBetweenCoordinates takes real x1, real y1, real x2, real y2 returns real
return Atan2(y2 - y1, x2 - x1)
endfunction[/code]

However if anyone can translate this into a GUI + Custom Script method you can ultra-solve this help thread. =) I'd appreciate it as well.
 
Last edited:
Level 24
Joined
Aug 1, 2013
Messages
4,657
In degrees?
  • Set TempUnit1 = (unit 1)
  • Set TempUnit2 = (unit 2)
  • Custom script: set udg_TempReal = bj_RADTODEG * Atan((GetUnitY(udg_TempUnit2) - (GetUnitY(udg_TempUnit1)) / (GetUnitX(udg_TempUnit2) - (GetUnitX(udg_TempUnit1)))
  • -------- TempReal = angle between TempUnit1 and TempUnit2 --------
 
Status
Not open for further replies.
Top