๐ขmath
This table extends the existing math table that is a part of Lua.
calc_angle๏ปฟ
Function
Calculates angles between 2 vectors.
Arguments
Returns
Angles.
Example
local ang = math.calc_angle(vec1, vec2);angle_normalize๏ปฟ
Function
Normalizes an angle.
Arguments
angle
float
Input angle.
Returns
float
Normalized angle.
Example
approach_angles๏ปฟ
Function
Approaches an angle over time.
Arguments
Returns
Delta angle.
Example
edge_point๏ปฟ
Function
Returns a point on the edge of a box.
Arguments
Returns
Point.
Example
lerp๏ปฟ
Function
Linear interpolation.
Arguments
t1
float
Start value.
t2
float
End value.
progress
float
Interpolation amount.
Returns
Type
Description
float
Interpolated value.
Example
vector_angles๏ปฟ
Function
Calculates angles from a vector.
Arguments
Returns
Angles.
Example
world_to_screen๏ปฟ
Function
Transforms a point in the game world onto the viewport.
Arguments
round
bool
Whether should round the output. Defaults to true.
Returns
Point on the viewport.
Example
clamp๏ปฟ
Function
Clamps a value between min and max.
Arguments
n
float
Value.
lower
float
Lowest value.
upper
float
Highest value.
Returns
float
Clamped value.
Example
remap_val๏ปฟ
Function
Maps the value from one range to another range.
Arguments
val
float
Value.
a
float
Lowest source value.
b
float
Highest source value.
c
float
Lowest destination value.
d
float
Highest destination value.
Returns
float
Mapped value.
Example
remap_val_clamped๏ปฟ
Function
Maps the value from one range to another range. Additionally, clamps the value based on the source range.
Arguments
val
float
Value.
a
float
Lowest source value.
b
float
Highest source value.
c
float
Lowest destination value.
d
float
Highest destination value.
Returns
float
Mapped value.
Example
vec2๏ปฟ
Function
An alias to draw.vec2().
Example
vec3๏ปฟ
Function
An alias to vector().
Example
Last updated