Angle

Category: Arithmetics
Since engine version: 1.0 OC

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 x1, int y1, int x2, int y2, int precision);

Parameters

x1:
X coordinate of the first point
y1:
Y coordinate of the first point
x2:
X coordinate of the second point
y2:
Y coordinate of the second point
precision:
[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(GetCursor(0)->GetX(), GetCursor(0)->GetY(),
           GetCursor(1)->GetX(), GetCursor(1)->GetY() ));
The object rotates so it points from the clonk of player 1 to the clonk of player 2.
See also: Cos, Sin
jwk, 2002-04
Clonk-Karl, 2004-09