Coordinate help..
#2

I did it .


Well, i understood that the distance between the player and the the yellow point is 10 , and i don't know what is the distance between the yellow point and the two red points, but you can modify this things in the code :


pawn Код:
stock GetXYInFrontOfPlayer(playerid,Float:X1, Float:Y1, Float:X2, Float:Y2)
{
    new Float:Temp, Float:Angle;
    GetPlayerPos(playerid,X1,Y1,Temp);
    GetPlayerPos(playerid,X2,Y2,Temp);
    GetPlayerFacingAngle(playerid, Angle);
    if(Angle >= 180 && Angle < 360) Angle -= 180;
    X1 += floatcos(Angle, degrees) * 10;
    X2 += floatcos(Angle, degrees) * 10;
    Y1 += floatsin(Angle, degrees) * 10;
    Y2 += floatsin(Angle, degrees) * 10;
    X1 -= 5; //Change 5 to the Distance between the left Red Point and the Yellow Point
    X2 += 2; //Change 2 to the Distance between the rigth Red Point and the Yellow Point
    return true;
}


Or, if you want that both angles in the yellow point have 90 degrees of measure (in other words, always exactly equal to the image you posted) :


pawn Код:
stock GetXYInFrontOfPlayer(playerid,Float:X1, Float:Y1, Float:X2, Float:Y2)
{
    new Float:Temp;
    GetPlayerPos(playerid,X1,Y1,Temp);
    GetPlayerPos(playerid,X2,Y2,Temp);
    Y1 += 10;
    Y2 += 10;
    X1 -= 5; //Change 5 to the Distance between the left Red Point and the Yellow Point
    X2 += 2; //Change 2 to the Distance between the rigth Red Point and the Yellow Point
    return true;
}


I hope that i have helped .
Reply


Messages In This Thread
[SOLVED] Coordinate help.. - by iPLEOMAX - 21.07.2011, 13:52
Re: Coordinate help.. - by rjjj - 21.07.2011, 15:33
Re: Coordinate help.. - by Mean - 21.07.2011, 16:13
Re: Coordinate help.. - by iPLEOMAX - 22.07.2011, 11:53

Forum Jump:


Users browsing this thread: 2 Guest(s)