16.05.2015, 08:59
The link in my sig has working example (arrow.inc)
Taken from the include with name changed, returns xy angle between 2 points:
X and Y being the point from which you want the angle.
Taken from the include with name changed, returns xy angle between 2 points:
X and Y being the point from which you want the angle.
pawn Код:
stock Float:AngleBetweenPoints(Float:X, Float:Y, Float:PointX, Float:PointY)
{
new Float:fAngle;
if(X > PointX && Y > PointY)
fAngle = floatabs(atan2(floatsub(PointX, X), floatsub(PointY, Y)));
if(X > PointX && Y <= PointY)
fAngle = floatadd(floatabs(atan2(floatsub(Y, PointY), floatsub(PointX, X))), 270.0);
if(X <= PointX && Y > PointY)
fAngle = floatadd(floatabs(atan2(floatsub(PointY, Y), floatsub(X, PointX))), 90.0);
if(X <= PointX && Y <= PointY)
fAngle = floatadd(floatabs(atan2(floatsub(X, PointX), floatsub(Y, PointY))), 180.0);
return fAngle >= 360.0 ? floatsub(fAngle, 360.0) : fAngle;
}