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


M_INFINITY
M_PI

Abs

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

ACos

ASin

ASin

Atan

Atan

Ceil

Ceil

Clamp

Clamp

Clamp01

Clamp01

Cos

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

CrossProduct

Deg2Rad

Deg2Rad

Distance

Distance

Distance2D

Distance2D

DotProduct

DotProduct

Equals

Equals

Floor

Floor

Frac

Frac

Invert01

Invert01

IsBetweenRange

IsBetweenRange

Max

Max

Min

Min

Modulo

Modulo

NextPowerOfTwo

NextPowerOfTwo

Pow

Pow

Rad2Deg

Rad2Deg

Sin

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

SquaredDistance

Sqrt

Sqrt

Tan

Tan

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