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

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 13
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