Teleport Vehicle to Vehicle Face Angle -
Hayden_Almeida - 16.12.2016
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):
And i am looking at NORH (0.0)
The second vehicle will be teleported to:
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??
Re: Teleport Vehicle to Vehicle Face Angle -
AbyssMorgan - 16.12.2016
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
Re: Teleport Vehicle to Vehicle Face Angle -
Hayden_Almeida - 16.12.2016
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??
Re: Teleport Vehicle to Vehicle Face Angle -
AbyssMorgan - 16.12.2016
Quote:
Originally Posted by Hayden_Almeida
GetVehicleOrientationPos ?? This function exists??
|
Yes, in
3DTryg.inc
Re: Teleport Vehicle to Vehicle Face Angle -
Swedky - 16.12.2016
PHP код:
new Float:fX, Float:fY, Float:fZ, Float:angle;
GetVehiclePos(vehicleid, fX, fY, fZ);
GetVehicleZAngle(vehicleid, angle);
SetVehiclePos(vehicle2, fX + (dist * floatsin(-angle, degrees)), fY + (dist + floatcos(-angle, degrees)), 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.
Re: Teleport Vehicle to Vehicle Face Angle -
Hayden_Almeida - 16.12.2016
Quote:
Originally Posted by Swedky
PHP код:
new Float:fX, Float:fY, Float:fZ, Float:angle;
GetVehiclePos(vehicleid, fX, fY, fZ);
GetVehicleZAngle(vehicleid, angle);
SetVehiclePos(vehicle2, fX + (dist * floatsin(-angle, degrees)), fY + (dist + floatcos(-angle, degrees)), 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.