• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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,658
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