02.04.2010, 04:15
I've figured it out for 2D coordinates (X,Y) but not yet for 3D coordinates (X,Y,Z)
I once used it to make an in-game compass that pointed out nearby players and the user's objective.
looked like this (if player was looking straight North)
|||||||||N|||||||||
|=player
|=objective
pawn Код:
Float:GetAngleBetweenPoints(Float:X1,Float:Y1,Float:X2,Float:Y2)
{
new Float:angle=atan2(X2-X1,Y2-Y1);
if(angle>360)angle-=360;
if(angle<0)angle+=360;
return angle;
}
looked like this (if player was looking straight North)
|||||||||N|||||||||
|=player
|=objective