Math
This table extends the existing math
table that is a part of Lua.
calc_angleīģŋ
Function
Calculates angles between 2 vectors.
Arguments
src
Source vector.
dst
Destination vector.
Returns
Angles.
Example
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
from
Start angle.
to
End angle.
speed
float
Approach speed.
Returns
Delta angle.
Example
edge_pointīģŋ
Function
Returns a point on the edge of a box.
Arguments
mins
Box mins.
maxs
Box maxs.
dir
Point direction (angle).
radius
float
Area radius.
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
forward
Source vector.
up
Up vector. Defaults to nil
.
Returns
Angles.
Example
world_to_screenīģŋ
Function
Transforms a point in the game world onto the viewport.
Arguments
xyz
Point in the world.
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
Example
vec3īģŋ
Function
Example
Last updated