Set Player Face Point?
#4

pawn Код:
stock SetPlayerLookAt(playerid, Float:X, Float:Y)
{
    new Float:Px, Float:Py, Float: Pa;
    GetPlayerPos(playerid, Px, Py, Pa);
    Pa = floatabs(atan((Y-Py)/(X-Px)));
    if (X <= Px && Y >= Py) Pa = floatsub(180, Pa);
    else if (X < Px && Y < Py) Pa = floatadd(Pa, 180);
    else if (X >= Px && Y <= Py) Pa = floatsub(360.0, Pa);
    Pa = floatsub(Pa, 90.0);
    if (Pa >= 360.0) Pa = floatsub(Pa, 360.0);
    SetPlayerFacingAngle(playerid, Pa);
}
Simple math.
Reply


Messages In This Thread
Set Player Face Point? - by Aerotactics - 25.11.2014, 01:17
Re : Set Player Face Point? - by MCZOFT - 25.11.2014, 01:30
Re: Re : Set Player Face Point? - by Aerotactics - 25.11.2014, 02:28
Re: Set Player Face Point? - by Write - 25.11.2014, 08:01

Forum Jump:


Users browsing this thread: 1 Guest(s)