SA-MP Forums Archive
X Y Z in front of player - 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: X Y Z in front of player (/showthread.php?tid=481367)



X Y Z in front of player UnFinished - Opah - 15.12.2013

How Can I get XYZ in front of player like when flying a plane and heading down to the ground ??


Re: X Y Z in front of player - BizzyD - 15.12.2013

Um, dont really know what you mean.

But to get a player cords, it should be like this:

Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);



Re: X Y Z in front of player - arakuta - 15.12.2013

Try this function.

pawn Код:
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    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));
}
I don't know who created this...


Re: X Y Z in front of player - Opah - 15.12.2013

Quote:
Originally Posted by arakuta
Посмотреть сообщение
Try this function.

pawn Код:
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    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));
}
I don't know who created this...
that gets the x and y in front of player i want x y z


Re: X Y Z in front of player - newbie scripter - 15.12.2013

Z = Height!!!


Re: X Y Z in front of player - arakuta - 15.12.2013

Z is the same as the player, don't?


Re: X Y Z in front of player - Kyle - 15.12.2013

Quote:
Originally Posted by Opah
Посмотреть сообщение
that gets the x and y in front of player i want x y z
You can use that function to get the X,Y but then you can use MapAndreas to obtain the Z from the X,Y from the first function.


Re: X Y Z in front of player - Opah - 15.12.2013

no guys you just dont get it
look i am in a hydra and heading to the ground (nose is looking towards the ground) i want the X and Y and Z (= height )of the point in front of me (while i am facing the ground) in distance D


AW: X Y Z in front of player - Nero_3D - 15.12.2013

Search for Quaternion Converter, or use GetVehicleRotationQuat and wikipedia (goto: For Euler angles)


Re: AW: X Y Z in front of player - Opah - 15.12.2013

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
Search for Quaternion Converter, or use GetVehicleRotationQuat and wikipedia (goto: For Euler angles)
Thanx Bro I Was Searching For Something Like That Trying Now To Make A Function