Z coordinate in front of vehicle. - 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: Z coordinate in front of vehicle. (
/showthread.php?tid=533681)
Z coordinate in front of vehicle. -
BuLLeT[LTU] - 25.08.2014
Hello. I wanted to ask if anyone knows how to get Z coordinate in front of vehicle in specified distance?
Re: Z coordinate in front of vehicle. -
Stinged - 25.08.2014
Use this to get the x y in front of the player.
pawn Код:
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance) // by ******
{
new Float:a;
GetPlayerPos(playerid, x, y, a);
GetPlayerFacingAngle(playerid, a);
if (GetPlayerVehicleID(playerid))
{
GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
}
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
}
Use MapAndreas to get Z point.
The
MapAndreas main plugin uses a lot of RAM.
MapAndreas v.1.2.1 plugin by Mauzen doesn't use a lot of RAM
The
MapAndreas include by RyDeR`doesn't use any RAM and has the same accuracy as the plugin.
Re: Z coordinate in front of vehicle. -
BuLLeT[LTU] - 25.08.2014
It's not what i want. The Z coordinate can be in the air. Eg. vehicle can be on the 60 degree road, so it will be looking to the sky. I need that Z coordinate i the air, 100.0 SA unit distance from vehicle position.
Re: Z coordinate in front of vehicle. -
Stinged - 25.08.2014
Then just use the z pos from the vehicle.
pawn Код:
new Float:x, Float:y, Float:z;
GetVehiclePos(vehicle, x, y, z);
GetXYInFrontOfPlayer(playerid, x, y, distance);
Re: Z coordinate in front of vehicle. -
Pottus - 25.08.2014
Currently the only way to do this is to use MapAndreas example.
pawn Код:
new Float:x, Float:y, Float:z;
GetVehiclePos(vehicle, x, y, z);
GetXYInFrontOfPlayer(playerid, x, y, distance);
MapAndreas_FindZ_For2DCoord(x, y, z);