modding:scripting:api:math

The scripting API provides various basic mathematics functions and constants to compute common mathematical operations and transformations.


M_INFINITY
M_PI

Abs

Description: Return the absolute value of a given number.

float Abs(float fNumber)
int Abs(int fNumber)

[in] fNumber: A number.
[return] Absolute value of fNumber.

Example:

float _Value = Abs(-5.0f); 
Print("absolute value of -5.0 is " + String(_Value));

ACos

ASin

Atan

Ceil

Clamp

Clamp01

Cos

Description: Returns the cosine of an angle of x radians.

float Cos(float fNumber)

[in] fNumber: Value representing an angle expressed in radians. One radian is equivalent to 180/PI degrees.
[return] Cosine of fNumber radians.

Example:

float _Value = Cos(1.5f);
Print("cosine of 1.5 is " + String(_Value));

Note: You can convert degrees to radians and vice version by using the Deg2Rad and Rad2Deg functions.

CrossProduct

Deg2Rad

Distance

Distance2D

DotProduct

Equals

Floor

Frac

Invert01

IsBetweenRange

Max

Min

Modulo

NextPowerOfTwo

Pow

Rad2Deg

Sin

Description: Returns the sine of an angle of x radians.

float Sin(float fNumber)

[in] fNumber: Value representing an angle expressed in radians. One radian is equivalent to 180/PI degrees.
[return] Sine of fNumber radians.

Example:

float _Value = Sin(1.5f);
Print("sine of 1.5 is " + String(_Value));

Note: You can convert degrees to radians and vice version by using the Deg2Rad and Rad2Deg functions.

SquaredDistance

Sqrt

Tan

  • modding/scripting/api/math.txt
  • Last modified: 14/10/2018 12:17
  • (external edit)