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

[JASS] Angle Calculations

Status
Not open for further replies.
Level 4
Joined
Jun 8, 2007
Messages
89
So, I currently have a function that rushes a unit along a given path, and as it passes other units, it will cause them to be knocked back, but I want all units to be pushed either perpendicularly to the path's left or the path's right depending on which side they fall on, but I'm confusing myself with the math involved. Currently I have:

JASS:
set angle                   = Atan2((yTarget - yCaster),(xTarget - xCaster))
            
            if (RAbsBJ(angle - GetUnitFacing(.caster)) < 3.14159) then
                set angle   = GetUnitFacing(.caster) + (3.14159 / 2)
            else
                set angle   = GetUnitFacing(.caster) - (3.14159 / 2)
            endif

with angle being the value that I am passing into the knockback function. Does anyone see what I am doing wrong? I'm probably just confused somewhere along the way.
 
Status
Not open for further replies.
Top