Angle

Category: Arithmetics
Since engine version: 4.6.5.0 CP (extended in 4.9.5.0 CE)

Description

Returns the view angle from the first point to the second in degrees. 0° ist straight up. All coordinates global.

Syntax

int Angle (int iX1, int iY1, int iX2, int iY2, int iPrec);

Parameters

iX1:
X coordinate of the first point
iY1:
Y coordinate of the first point
iX2:
X coordinate of the second point
iY2:
Y coordinate of the second point
iPrec:
[opt] Multiplied with the angle. For a higher precision while working with integers (whole numbers) you can specify a higher precision value. A precision of 10 will produce values from 0 to 3600.

Example

SetR(Angle(GetX(GetCursor(0)), GetY(GetCursor(0)),
           GetX(GetCursor(1)), GetY(GetCursor(1)) ));
The object rotates so it points from the clonk of player 1 to the clonk of player 2.
See also: Cos, Sin
jwk, April 2002
Clonk-Karl, September 2004