• 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.

[Solved] Changing building facing

Status
Not open for further replies.
Level 26
Joined
Aug 18, 2009
Messages
4,097
JASS:
Atan2(GetSpellTargetY() - GetUnitY(GetTriggerUnit()), GetSpellTargetX() - GetUnitX(GetTriggerUnit()))

288px-Trigonometry_triangle.svg.png


You want to get alpha. Opposite is y difference, adjacent x difference. Tan alpha is opposite divided by adjacent, so take arctan from that. Atan2 ensures that there is no division by zero.
 
Level 6
Joined
Jun 10, 2012
Messages
240
It can also be done by Action: Unit - Make (Your building) <gen> face (your choice) degrees facing over (your choice) seconds
You will be the one to select it's events and conditions. Hope it would help.
 
Status
Not open for further replies.
Top