21.01.2014, 17:20
Hey folks!
Im working on an include, and i would like to know, how to calculate the XY pos in front of an object?
My solution was this:
It works when the object is facing to 180° (opposite direction of North), but when i change the objects Y rotation, it moves to the wrong diretcion.
Hope u can help me, thanks!
Im working on an include, and i would like to know, how to calculate the XY pos in front of an object?
My solution was this:
Code:
new Float:Tx, Float:Ty, Float:Tz; new Float:TRY,Float:TRZ; GetObjectPos(Targets[targetid][main_object_id], Tx, Ty, Tz); GetObjectRot(Targets[targetid][main_object_id], TRY, TRY, TRZ); Tx += (distance * floatsin(-TRY, degrees)); Ty += (distance * floatcos(-TRY, degrees)); MoveObject(Targets[targetid][main_object_id], Tx, Ty, Tz, speed);
Hope u can help me, thanks!