Z coordinate in front of vehicle.
#1

Hello. I wanted to ask if anyone knows how to get Z coordinate in front of vehicle in specified distance?
Reply
#2

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.
Reply
#3

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.
Reply
#4

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);
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)