Quote:
Originally Posted by iggy1
The link in my sig has working example (arrow.inc)
Taken from the include with name changed, returns xy angle between 2 points:
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; }
|
Thanks for answer. But you represent the function that I know:
PHP код:
stock Float:GetAngleZFromPoints(Float:x1, Float:y1, Float:x2, Float:y2) {
return (180.0 - atan2(x1-x2, y1-y2));
}
Attached picture with an example
How do I get the angle between the Rocket and the player? To rotate it by vertical?