NanosMath
A table containing useful and aux Math functions
info
Tip: This structure is Open Sourced at https://github.com/nanos-world/nanos-world-lua-lib. Feel free to push merge requests and suggest changes!
Usageβ
local axis = NanosMath.ClampAxis(720)
Static Functionsβ
Returns | Name | Description |
---|---|---|
number | Round | Rounds a number |
number | Clamp | |
number | ClampAxis | Clamps an angle to the range of [0, 360] |
number | NormalizeAxis | Clamps an angle to the range of [-180, 180] |
number | FInterpTo | Interpolate number from Current to Target |
Rotator | RInterpTo | Interpolate Rotator from Current to Target |
Rotator | RInterpConstantTo | Interpolate Rotator from Current to Target with a constant step |
Vector | VInterpTo | Interpolate Vector from Current to Target |
Vector | VInterpConstantTo | Interpolate Vector from Current to Target with a constant step |
Round
β
Rounds a number
NanosMath.Round(value)
Type | Parameter | Description |
---|---|---|
number | value |
Clamp
β
Clamps a number
NanosMath.Clamp(value, min, max)
Type | Parameter | Description |
---|---|---|
number | value | |
number | min | |
number | max |
ClampAxis
β
Clamps an angle to the range of [0, 360].
NanosMath.ClampAxis(value)
Type | Parameter | Description |
---|---|---|
number | value |
NormalizeAxis
β
Clamps an angle to the range of [-180, 180].
NanosMath.NormalizeAxis(value)
Type | Parameter | Description |
---|---|---|
number | value |
FInterpTo
β
Interpolate scalar from Current to Target
NanosMath.FInterpTo(current, target, delta_time, interp_speed)
Type | Parameter | Description |
---|---|---|
number | current | |
number | target | |
number | delta_time | |
number | interp_speed |
RInterpTo
β
Interpolate Rotator from Current to Target
NanosMath.RInterpTo(current, target, delta_time, interp_speed)
Type | Parameter | Description |
---|---|---|
Rotator | current | |
Rotator | target | |
number | delta_time | |
number | interp_speed |
RInterpConstantTo
β
Interpolate Rotator from Current to Target with a constant step
NanosMath.RInterpConstantTo(current, target, delta_time, interp_speed)
Type | Parameter | Description |
---|---|---|
Rotator | current | |
Rotator | target | |
number | delta_time | |
number | interp_speed |
VInterpTo
β
Interpolate Vector from Current to Target
NanosMath.VInterpTo(current, target, delta_time, interp_speed)
Type | Parameter | Description |
---|---|---|
Vector | current | |
Vector | target | |
number | delta_time | |
number | interp_speed |
VInterpConstantTo
β
Interpolate Vector from Current to Target with a constant step
NanosMath.VInterpConstantTo(current, target, delta_time, interp_speed)
Type | Parameter | Description |
---|---|---|
Vector | current | |
Vector | target | |
number | delta_time | |
number | interp_speed |