tuantai120
Cool Member
- Reaction score
- 1
How to make the dummy move like this with x , y and TT ???
thanks very much
thanks very much
set x = GetUnitX(myDummyUnit) + SomeOffset * Cos(myAngle * bj_DEGTORAD)
set y = GetUnitY(myDummyUnit) + SomeOffset * Sin(myAngle * bj_DEGTORAD)
just make sure the value of the angle is in radians.
It is better to use radians as you don't have to convert back and forth but if you are totally messing with degrees, you have to do converting which is inefficient.
library XY
function OrbitX takes real X, real dist, real angle returns real
return ( X + dist * Cos(angle * bj_DEGTORAD) )
endfunction
function OrbitY takes real Y, real dist, real angle returns real
return ( Y + dist * Sin(angle * bj_DEGTORAD) )
endfunction
function DisXY takes real X1, real Y1, real X2, real Y2 returns real
local real dx = X2 - X1
local real dy = Y2 - Y1
return SquareRoot(dx * dx + dy * dy)
endfunction
function AngXY takes real X1, real Y1, real X2, real Y2 returns real
return bj_RADTODEG * Atan2(Y2 - Y1, X2 - X1)
endfunction
endlibrary
call OrbitX(X, distance, angle)
call OrbitY(Y,distance, angle)
call DisXY(X1, Y1, X2, Y2)
call AngXY(X1, Y1, X2, Y2)
PolarProjectionBJ.
Because they make things easier to work with and reduce your total code length.
And because working in radians with angle arithmetic is painful.
It's largely an ease-of-use thing, and it's awesome.
No, because no BJ's are built for handling it directly with coordinates.In that case you should write your code with the BJ's until it works, and then convert them to natives. They are really inefficient for moving units if you don't want lag.