Get Coords between 2 players
#5

hm... you first need to calculate the angle for player 1:
pawn Код:
new Float:angle=atan2(player1x-player2x,player1y-player2y);
since you know the angle, you can use the sinus/cosinus and a radius (2 meters?) to calculate new x,y coordinates.
pawn Код:
new player1xoffset=2*sin(angle,degrees);
new player1yoffset=2*cos(angle,degrees);
since those are only the offsets (relative to the player), you need to add player1's coordinates (x and y) to the results.
maybe you need to use (-angle,degrees) when NPCs/players/objects are facing the wrong direction - the formula should be (almost) ok..
Reply


Messages In This Thread
Get Coords between 2 players - by Om3n - 26.03.2013, 08:32
Re: Get Coords between 2 players - by dusk - 26.03.2013, 08:44
Re: Get Coords between 2 players - by Om3n - 26.03.2013, 08:47
Re: Get Coords between 2 players - by telmo_ferreira - 26.03.2013, 08:57
Re: Get Coords between 2 players - by Babul - 26.03.2013, 11:40

Forum Jump:


Users browsing this thread: 2 Guest(s)