Table of Contents

Common available functions

Abs(Number) -> Number

Calculates the absolute value.

Abs(-2) = 2

Min(Number, Number) -> Number

Returns the minimum value of the two inputs.

Min(10, 3) = 3

Min(Number[]) -> Number

Returns the minimum value in an array of numbers.

Min([10, -3, 2]) = -3

Max(Number, Number) -> Number

Returns the maximum value of the two inputs.

Max(10, 3) = 10

Max(Number[]) -> Number

Returns the maximum value in an array of numbers.

Max([10, -3, 2]) = 10

Clamp(Number, min: Number, max: Number) -> Number

Clamps the number in the range between min and max.

Clamp(4, -10, 10) = 4
Clamp(-125, -10, 10) = -10

Round(Number) -> Number

Rounds the value to the nearest integer.

Round(12.45) = 12
Round(12.8) = 13

Ceiling(Number) -> Number

Rounds the value up to the nearest integer.

Ceiling(12.45) = 13
Ceiling(12.8) = 13

Floor(Number) -> Number

Rounds the value down to the nearest integer.

Floor(12.45) = 12
Floor(12.8) = 12

Fraction(Number) -> Number

Returns the fractional part of the number.

Fraction(12.45) = 0.45

Mod(Number, Number) -> Number

Returns the remainder when first argument is being divided by the second.

Mod(10, 3) = 1

Sign(Number) -> Number

Returns -1 for negative, 1 for positive and 0 for zero input.

Sign(5) = 1
Sign(0) = 0
Sign(-12) = -1

Sqrt(Number) -> Number

Returns the square root of the input.

Sqrt(16) = 4

Exp(Number) -> Number

Calculates the natural exponentiation of a given number.

Pow(Number, exponent: Number) -> Number

Raises the first argument to the power of the second argument.

Pow(2, 5) = 32

Log(Number) -> Number

Natural logarithm function.

Log(Number, base: Number) -> Number

Calculates logarithm in a given base.

ToDegrees(Number) -> Number

Converts radians to degrees.

ToRadians(Number) -> Number

Converts degrees to radians.

Sin(Number) -> Number

Trigonometric sin function. Input angle is in radians.

Cos(Number) -> Number

Trigonometric cos function. Input angle is in radians.

Tan(Number) -> Number

Trigonometric tan function. Input angle is in radians.

Asin(Number) -> Number

Trigonometric inverse sin function. Output angle is in radians.

Acos(Number) -> Number

Trigonometric inverse cos function. Output angle is in radians.

Atan(Number) -> Number

Trigonometric inverse tan function. Output angle is in radians.

Sum(Number[]) -> Number

Calculates the sum of elements in a vector or an array.

Sum([10, -3, 2, 5]) = 14

Length(Number[]) -> Number

Calculates the length of a vector.

Length([3, 4]) = 5

LengthSquared(Number[]) -> Number

Calculates the length squared of a vector. This is faster to calculate than the length in cases where the exact length value is not needed, like when comparing lengths of two vectors.

LengthSquared([2, 6]) = 40
LengthSquared([2, 6]) > LengthSquared([3, 4]) = true

Dot(Number[N], Number[N]) -> Number

Calculates the dot product of two vectors. The vectors must be the same length.

Dot([2, 3], [-1, 4]) = 10

Cross(Number[3], Number[3]) -> Number[3]

Calculates the cross product of two three-dimensional vectors.

Mix(number1: Number, number2: Number, amount: Number) -> Number

Linearly interpolates between number1 and number2 based on the amount (usually in range 0.0 - 1.0)

Mix(2, 10, 0.0) = 2
Mix(2, 10, 0.5) = 6
Mix(2, 10, 1.0) = 10

SmoothStep(min: Number, max: Number, Number) -> Number

Calculates the Hermite interpolation between two values.

Normalized(Number[]) -> Number

Normalizes a numeric vector.

Distance(Number[N], Number[N]) -> Number

Calculates the distance between two points. The vectors must be the same length.

AngleBetween(Number[N], Number[N]) -> Number

Calculates the angle between two direction vectors in radians. The vectors must be the same length.

Reverse(Any[N]) -> Any[N]

Reverses the order of elements in an vector or array.

Reverse([1, 2, 3]) = [3, 2, 1]
Reverse([100, true, "Text"]) = ["Text", true, 100]