darkbeer
Beer is Good!
- Reaction score
- 84
Hey, i want my unit to be moved at a certain speed into a certain direction. Its my first time using Radians instead of Degrees, unfortunately the unit moves totally wrong -.-
it moves very slow (althought the accerleration great enough) and in the absolute wrong direction
heres the code:
EDIT: Something about thy Y coordinate musst be wrong -.-
thankfull for any suggestions^^
it moves very slow (althought the accerleration great enough) and in the absolute wrong direction
heres the code:
JASS:
set X = GetUnitX(dat.missile)
set Y = GetUnitX(dat.missile)
set targX = GetUnitX(dat.target)
set targY = GetUnitY(dat.target)
set angle = Atan2(targY - Y, targX - X)
call BJDebugMsg("angle: " + R2S(angle))
call BJDebugMsg("Angle Degree: " + R2S(angle * bj_RADTODEG))
call BJDebugMsg("X: " + R2S(X + dat.acceleration * Cos(angle)))
call BJDebugMsg("Cos: " + R2S(Cos(angle)))
call BJDebugMsg("UnitFacing Radians: " + R2S(GetUnitFacing(dat.missile)* bj_DEGTORAD))
call SetUnitPosition(dat.missile, X + dat.acceleration * Cos(angle), Y + dat.acceleration * Sin(angle))
EDIT: Something about thy Y coordinate musst be wrong -.-
thankfull for any suggestions^^