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