Cokemonkey11
New Member
- Reaction score
- 18
JASS:
function moveUnit takes nothing returns nothing
local location currentPos
local real slideFacingDeg
local real currentSlideDeg
local location currentPosOff
local real posOffX
local real posOffY
local real AcosRad
local integer resultDeg
local real slideFacingRad
local real currentSlideRad
set currentPos = GetUnitLoc(slideUnit)
set slideFacingDeg = GetUnitFacing(slideUnit)
set currentSlideDeg = I2R(i)
set slideFacingRad = Deg2Rad(slideFacingDeg)
set currentSlideRad = Deg2Rad(currentSlideDeg)
set AcosRad = Acos(Cos(slideFacingRad-currentSlideRad))
set resultDeg = R2I(Rad2Deg(AcosRad))
if resultDeg > 0 then
set i = i-4
else
set i = i+4
endif
set currentPosOff = PolarProjectionBJ(currentPos,10,i)
set posOffX = GetLocationX(currentPosOff)
set posOffY = GetLocationY(currentPosOff)
call SetUnitX(slideUnit,posOffX)
call SetUnitY(slideUnit,posOffY)
endfunction
Anyone see anything specifially wrong? i tink if resultDeg > 0 needs to be changed but I can't tell
I got the math from a friend...