[JASS] How to make unit move forward

Status
Not open for further replies.
Hi guys I want to move a unit forward with a timer, however I have problems with the formula ... can some one help me and tell me what is wrong?

PS: data.bomber is a bomber, the unit I want to move

JASS:
call SetUnitPosition(data.bomber, GetUnitX(data.bomber)* Cos(GetUnitFacing(data.bomber)) + (6 * Cos(GetUnitFacing(data.bomber))), GetUnitY(data.bomber)*Sin(GetUnitFacing(data.bomber)) + (6 * Sin(GetUnitFacing(data.bomber))))
 
JASS:
call SetUnitPosition(data.bomber, GetUnitX(data.bomber) + (6 * Cos(GetUnitFacing(data.bomber))), GetUnitY(data.bomber) + (6 * Sin(GetUnitFacing(data.bomber))))
// more efficient way
// note that SetUnitX/Y() doesnt interrupt orders, while SetUnitPosition does.
call SetUnitX(data.bomber, GetUnitX(data.bomber) + (6 * Cos(GetUnitFacing(data.bomber))))
call SetUnitY(data.bomber, GetUnitY(data.bomber) + (6 * Sin(GetUnitFacing(data.bomber))))

if youre using this in a struct enivornemt save the values of Cos/Sin(unitfacing) in some variables.
 
Status
Not open for further replies.
Back
Top