Mathematical tools Reference
A set of mathematical functions that can be used in expressions.
Expressions
| Expression | Description | |
|---|---|---|
AngleBetweenPositions() | 
Compute the angle between two positions (in degrees). | |
AngleDifference() | 
Difference between two angles | |
DistanceBetweenPositions() | 
Compute the distance between two positions. | |
Pi() | 
The number Pi (3.1415...) | |
Random() | 
Random integer | |
RandomFloat() | 
Random float | |
RandomFloatInRange() | 
Random float in range | |
RandomInRange() | 
Random integer in range | |
RandomWithStep() | 
Random value in steps | |
XFromAngleAndDistance() | 
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. | |
YFromAngleAndDistance() | 
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. | |
abs() | 
Absolute value | |
acos() | 
Arccosine, return an angle (in radian). ToDeg allows to convert it to degrees. | 
|
acosh() | 
Hyperbolic arccosine | |
asin() | 
Arcsine, return an angle (in radian). ToDeg allows to convert it to degrees. | 
|
asinh() | 
Arcsine | |
atan() | 
Arctangent, return an angle (in radian). ToDeg allows to convert it to degrees. | 
|
atan2() | 
2 argument arctangent (atan2) | |
atanh() | 
Hyperbolic arctangent | |
cbrt() | 
Cube root | |
ceil() | 
Round number up to an integer | |
ceilTo() | 
Round number up to the Nth decimal place | |
clamp() | 
Restrict a value to a given range | |
cos() | 
Cosine of an angle (in radian). If you want to use degrees, useToRad: sin(ToRad(45)). | 
|
cosh() | 
Hyperbolic cosine | |
cot() | 
Cotangent of a number | |
csc() | 
Cosecant of a number | |
exp() | 
Exponential of a number | |
floor() | 
Round number down to an integer | |
floorTo() | 
Round number down to the Nth decimal place | |
lerp() | 
Linearly interpolate a to b by x | |
lerpAngle() | 
Linearly interpolates between two angles (in degrees) by taking the shortest direction around the circle. | |
log() | 
Logarithm | |
log10() | 
Base-10 logarithm | |
log2() | 
Base 2 Logarithm | |
max() | 
Maximum of two numbers | |
min() | 
Minimum of two numbers | |
mod() | 
x mod y | |
normalize() | 
Remap a value between 0 and 1. | |
nthroot() | 
Nth root of a number | |
pow() | 
Raise a number to power n | |
round() | 
Round a number | |
roundTo() | 
Round a number to the Nth decimal place | |
sec() | 
Secant | |
sign() | 
Return the sign of a number (1,-1 or 0) | |
sin() | 
Sine of an angle (in radian). If you want to use degrees, useToRad: sin(ToRad(45)). | 
|
sinh() | 
Hyperbolic sine | |
sqrt() | 
Square root of a number | |
tan() | 
Tangent of an angle (in radian). If you want to use degrees, useToRad: tan(ToRad(45)). | 
|
tanh() | 
Hyperbolic tangent | |
trunc() | 
Truncate a number | 
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.