• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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