• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Unit is In Front Of Me

Status
Not open for further replies.
Level 10
Joined
Jan 21, 2007
Messages
576
Alright i need to know how to make a conidition checkng if a point is in front of a unit. Kind of the oposite of checking if a unit is behind you to backstab.

In the attached file the arrow is the way the unit is faceing, i want to check if a point is within the angles extending from the unit.
 

Attachments

  • Example.jpg
    Example.jpg
    3.9 KB · Views: 112
http://www.wc3jass.com/viewtopic.php?t=146 Link to IsAngleBetweenAngles() function
  • Custom script: local unit caster
  • Custom script: local real x
  • Custom script: local real y
  • Custom script: local real facing=GetUnitFacing(caster)
  • Custom script: if IsAngleBetweenAngles(Atan2(y-GetUnitY(caster), x-GetUnitX(caster)), facing+90, facing-90) then
  • //actions here
  • Custom script: endif
Will do the actions placed within the if, if the point 'x,y' is infront of caster.
 
Status
Not open for further replies.
Top