Mathematical tools
A set of mathematical functions that can be used in expressions.
Expressions
Expression | Description | |
---|---|---|
AngleBetweenPositions(number, number, number, number) |
Compute the angle between two positions (in degrees). | |
🔢 Number | First point X position | |
🔢 Number | First point Y position | |
🔢 Number | Second point X position | |
🔢 Number | Second point Y position | |
AngleDifference(number, number) |
Difference between two angles | |
🔢 Number | First angle, in degrees | |
🔢 Number | Second angle, in degrees | |
DistanceBetweenPositions(number, number, number, number) |
Compute the distance between two positions. | |
🔢 Number | First point X position | |
🔢 Number | First point Y position | |
🔢 Number | Second point X position | |
🔢 Number | Second point Y position | |
Pi() |
The number Pi (3.1415...) | |
Random(number) |
Random integer | |
🔢 Number | Maximum value | |
RandomFloat(number) |
Random float | |
🔢 Number | Maximum value | |
RandomFloatInRange(number, number) |
Random float in range | |
🔢 Number | Minimum value | |
🔢 Number | Maximum value | |
RandomInRange(number, number) |
Random integer in range | |
🔢 Number | Minimum value | |
🔢 Number | Maximum value | |
RandomWithStep(number, number, number) |
Random value in steps | |
🔢 Number | Minimum value | |
🔢 Number | Maximum value | |
🔢 Number | Step | |
XFromAngleAndDistance(number, number) |
Compute the X position when given an angle and distance relative to the origin (0;0). This is also known as getting the cartesian coordinates of a 2D vector, using its polar coordinates. | |
🔢 Number | Angle, in degrees | |
🔢 Number | Distance | |
YFromAngleAndDistance(number, number) |
Compute the Y position when given an angle and distance relative to the origin (0;0). This is also known as getting the cartesian coordinates of a 2D vector, using its polar coordinates. | |
🔢 Number | Angle, in degrees | |
🔢 Number | Distance | |
abs(number) |
Absolute value | |
🔢 Number | Expression | |
acos(number) |
Arccosine, return an angle (in radian). ToDeg allows to convert it to degrees. |
|
🔢 Number | Expression | |
acosh(number) |
Hyperbolic arccosine | |
🔢 Number | Expression | |
asin(number) |
Arcsine, return an angle (in radian). ToDeg allows to convert it to degrees. |
|
🔢 Number | Expression | |
asinh(number) |
Arcsine | |
🔢 Number | Expression | |
atan(number) |
Arctangent, return an angle (in radian). ToDeg allows to convert it to degrees. |
|
🔢 Number | Expression | |
atan2(number, number) |
2 argument arctangent (atan2) | |
🔢 Number | Y | |
🔢 Number | X | |
atanh(number) |
Hyperbolic arctangent | |
🔢 Number | Expression | |
cbrt(number) |
Cube root | |
🔢 Number | Expression | |
ceil(number) |
Round number up to an integer | |
🔢 Number | Expression | |
ceilTo(number, number) |
Round number up to the Nth decimal place | |
🔢 Number | Expression | |
🔢 Number | Expression Optional. | |
clamp(number, number, number) |
Restrict a value to a given range | |
🔢 Number | Value | |
🔢 Number | Min | |
🔢 Number | Max | |
cos(number) |
Cosine of an angle (in radian). If you want to use degrees, useToRad : sin(ToRad(45)) . |
|
🔢 Number | Expression | |
cosh(number) |
Hyperbolic cosine | |
🔢 Number | Expression | |
cot(number) |
Cotangent of a number | |
🔢 Number | Expression | |
csc(number) |
Cosecant of a number | |
🔢 Number | Expression | |
exp(number) |
Exponential of a number | |
🔢 Number | Expression | |
floor(number) |
Round number down to an integer | |
🔢 Number | Expression | |
floorTo(number, number) |
Round number down to the Nth decimal place | |
🔢 Number | Expression | |
🔢 Number | Expression Optional. | |
lerp(number, number, number) |
Linearly interpolate a to b by x | |
🔢 Number | a (in a+(b-a) * x) | |
🔢 Number | b (in a+(b-a) * x) | |
🔢 Number | x (in a+(b-a) * x) | |
lerpAngle(number, number, number) |
Linearly interpolates between two angles (in degrees) by taking the shortest direction around the circle. | |
🔢 Number | Starting angle, in degrees | |
🔢 Number | Destination angle, in degrees | |
🔢 Number | Interpolation value between 0 and 1. | |
log(number) |
Logarithm | |
🔢 Number | Expression | |
log10(number) |
Base-10 logarithm | |
🔢 Number | Expression | |
log2(number) |
Base 2 Logarithm | |
🔢 Number | Expression | |
max(number, number) |
Maximum of two numbers | |
🔢 Number | First expression | |
🔢 Number | Second expression | |
min(number, number) |
Minimum of two numbers | |
🔢 Number | First expression | |
🔢 Number | Second expression | |
mod(number, number) |
x mod y | |
🔢 Number | x (as in x mod y) | |
🔢 Number | y (as in x mod y) | |
normalize(number, number, number) |
Remap a value between 0 and 1. | |
🔢 Number | Value | |
🔢 Number | Min | |
🔢 Number | Max | |
nthroot(number, number) |
Nth root of a number | |
🔢 Number | Number | |
🔢 Number | N | |
pow(number, number) |
Raise a number to power n | |
🔢 Number | Number | |
🔢 Number | The exponent (n in "x to the power n") | |
round(number) |
Round a number | |
🔢 Number | Expression | |
roundTo(number, number) |
Round a number to the Nth decimal place | |
🔢 Number | Expression | |
🔢 Number | Expression Optional. | |
sec(number) |
Secant | |
🔢 Number | Expression | |
sign(number) |
Return the sign of a number (1,-1 or 0) | |
🔢 Number | Expression | |
sin(number) |
Sine of an angle (in radian). If you want to use degrees, useToRad : sin(ToRad(45)) . |
|
🔢 Number | Expression | |
sinh(number) |
Hyperbolic sine | |
🔢 Number | Expression | |
sqrt(number) |
Square root of a number | |
🔢 Number | Expression | |
tan(number) |
Tangent of an angle (in radian). If you want to use degrees, useToRad : tan(ToRad(45)) . |
|
🔢 Number | Expression | |
tanh(number) |
Hyperbolic tangent | |
🔢 Number | Expression | |
trunc(number) |
Truncate a number | |
🔢 Number | Expression |
This page is an auto-generated reference page about the Mathematical tools feature of GDevelop, the open-source, cross-platform game engine designed for everyone. Learn more about all GDevelop features here.