SA-MP Forums Archive
Move a object on my body - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Move a object on my body (/showthread.php?tid=559755)



Move a object where I am facing - Flokx - 25.01.2015

So when I am on a vehicle and my vehicle has objects. I wan't them to go right where I am facing with my car with /move cmd. I have tried and failed hardly. Please help me somehow +rep

Here:
Код:
new Float:x, Float:y, Float:z;
GetObjectPos(objectid, x, y, z);
new movetime = MoveObject(objectid, x+100, y, z, 4.00);
The object is in my position and I am in a vehicle. I want it to go right where I am facing. But it's moving randomly anywhere.


Re: Move a object on my body - Flokx - 25.01.2015

Bump


AW: Move a object on my body - Saize - 25.01.2015

Try it with GetPlayerCameraPos(), get the Floats and move the Object to that values


Re: Move a object on my body - Crayder - 25.01.2015

This is possibly not right, it would be something like this (you should try this):

pawn Код:
new Float:x, Float:y, Float:z, Float:VX, Float:VY, Float:A, movetime;
GetObjectPos(playerid, x, y, z); //obj pos
GetPlayerCameraFrontVector(playerid, VX, VY, A); //front vector, obviously
A = atan2(VY, VX) - 180.0; //Angle right of player's camera
movetime = MoveObject(objectid, x+floatsin(-A, degrees), y+floatcos(A, degrees), z, 4.00);