Getting XY in front of an object.
#1

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:

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);
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!
Reply


Messages In This Thread
Getting XY in front of an object. - by kadaradam - 21.01.2014, 17:20
Re: Getting XY in front of an object. - by thefatshizms - 21.01.2014, 17:29
Re: Getting XY in front of an object. - by Pottus - 21.01.2014, 17:38
Re: Getting XY in front of an object. - by kadaradam - 23.01.2014, 10:36

Forum Jump:


Users browsing this thread: 1 Guest(s)