Teleport Vehicle to Vehicle Face Angle
#1

I am trying to do this:

Teleport one vehicle to another vehicle's back. Whatever the angle i am looking at.

Example:
If i am im pos (inside vehicle, state driver):
Код:
0.0 , 0.0 , 0.0
And i am looking at NORH (0.0)
The second vehicle will be teleported to:
Код:
0.0 , -1.0 , 0.0
Because when i move to NORTH, the Y position is changing.
So my logic at this point is: Get the BOTH vehicle positions and the ZAngle of the FIRST vehicle (i am in it). And now??
Reply
#2

For example, if you want to set the vehicle behind the vehicle.
PHP код:
new Float:tx,Float:ty,Float:tz,Float:angle;
GetVehicleOrientationPos(vehicleid,o_back,10.0,tx,ty,tz);
SetVehiclePos(new_vehicleid,tx,ty,tz);
GetVehicleZAngle(vehicleid,angle);
SetVehicleZAngle(new_vehicleid,angle); 
3DTryg.inc:
https://sampforum.blast.hk/showthread.php?tid=591010
Reply
#3

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
For example, if you want to set the vehicle behind the vehicle.
PHP код:
new Float:tx,Float:ty,Float:tz,Float:angle;
GetVehicleOrientationPos(vehicleid,o_back,10.0,tx,ty,tz);
SetVehiclePos(new_vehicleid,tx,ty,tz);
GetVehicleZAngle(vehicleid,angle);
SetVehicleZAngle(new_vehicleid,angle); 
3DTryg.inc:
https://sampforum.blast.hk/showthread.php?tid=591010
GetVehicleOrientationPos ?? This function exists??
Reply
#4

Quote:
Originally Posted by Hayden_Almeida
Посмотреть сообщение
GetVehicleOrientationPos ?? This function exists??
Yes, in 3DTryg.inc
Reply
#5

PHP код:
new Float:fXFloat:fYFloat:fZFloat:angle;
GetVehiclePos(vehicleidfXfYfZ);
GetVehicleZAngle(vehicleidangle);
SetVehiclePos(vehicle2fX + (dist floatsin(-angledegrees)), fY + (dist floatcos(-angledegrees)), fZ); 
Change "dist" to the distance where you want to put "vehicle2". Positive values will put it in front, negative will put it in back.
Reply
#6

Quote:
Originally Posted by Swedky
Посмотреть сообщение
PHP код:
new Float:fXFloat:fYFloat:fZFloat:angle;
GetVehiclePos(vehicleidfXfYfZ);
GetVehicleZAngle(vehicleidangle);
SetVehiclePos(vehicle2fX + (dist floatsin(-angledegrees)), fY + (dist floatcos(-angledegrees)), fZ); 
Change "dist" to the distance where you want to put "vehicle2". Positive values will put it in front, negative will put it in back.
Does not work so well.
I am trying to detach the Trailer from truck, but if i only use the Function "DetachTrailerFromVehicle" it not sync sometime with other players. Know how to solve it?
With some tests i came to use teleport trailer from 2 meters of the truck behind it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)