• 🏆 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!

Units in front of Caster from 45-135 degrees

Status
Not open for further replies.
Level 9
Joined
Sep 28, 2004
Messages
365
Hi all, i am having a problem dectecting Units in front of 45-135 degrees of the caster. Anyone can help me with the formula?

  • (Angle from multi_casterPos to multi_victimPos) Greater than or equal to 45.00
  • (Angle from multi_casterPos to multi_victimPos) Less than 135.00
Is my above trigger correct?
 
Level 12
Joined
Apr 15, 2008
Messages
1,063
First of all, 45-135 degrees is not in front of, but to the left of caster.
Second, this will always pick units to north of caster, because you didn't consider facing of caster
Correct would be:
angle = Modulo( Angle between points - (facing of caster+90) , 360 )
Unit is in cone if angle<45 or (360-angle)<45
I am going to test it now, but I think it should work like this
 
Status
Not open for further replies.
Top