Coordinate help..
#1

I already found an alternative solution when i was going to sleep at night but i woke up at morning and forgot ffs.

._.

This image: [TOP VIEW]


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

If you want to get XY left/right of player, you can check my AB script.

You can get it by modding GetXYInFrontOfPlayer's angle. For example, do:
pawn Код:
angle = angle - 90;
and it will get X and Y right to player. +90 for left.
EDIT: It's not "angle" in GetXYInFrontOfPlayer, it's "a". I didn't exactly understand your question fully.
Reply
#4

Lol.. Thanks guys. I just needed to change the Angle.

Basically Change the T shape into a V shape, getting two points with angle offset. xD

rep +
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)