NanosMath
A table containing useful and aux Math functions.
🗿Static Class
This is a Static Class. Access it's methods directly with
.
. It's not possible to spawn new instances.👐Open Source
This library implementation is Open Sourced on GitHub!
🧑💻API Source
This page is auto-generated! The Functions, Properties and Events described here are defined in our GitHub's API Repository! Feel free to commit suggestions and changes to the source .json API files!
🎒 Examples
(NanosMath.ClampAxis) Clamping an angle
local axis = NanosMath.ClampAxis(720)
(NanosMath.FInterpTo) Interpolating a number until it reaches 100 with speed 3
local my_value = 0
Client.Subscribe("Tick", function(delta_time)
my_value = NanosMath.FInterpTo(my_value, 100, delta_time, 3)
end)
(NanosMath.VInterpTo) Interpolating a Vector until it reaches Vector(1000, 200, 100) with speed 5
local my_value = Vector(0, 0, 0)
Client.Subscribe("Tick", function(delta_time)
my_value = NanosMath.VInterpTo(my_value, Vector(1000, 200, 100), delta_time, 5)
end)
🗿 Static Functions
Returns | Name | Description | |
---|---|---|---|
number | Round | Rounds a number | |
number | Clamp | Clamps a number | |
number | ClampAxis | Clamps an angle to the range of [0, 360] | |
number | NormalizeAxis | Clamps an angle to the range of [-180, 180] | |
Vector, Rotator | RelativeTo | Calculates the location and rotation relative to an actor | |
float | RandomFloat | Returns a random float value | |
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
— Returns number (the rounded number).
local ret = NanosMath.Round(value)
Type | Parameter | Default | Description |
---|---|---|---|
number | value | Required parameter | The number to be rounded |
Clamp
Clamps a number
— Returns number (the number clamped).
local ret = NanosMath.Clamp(value, min, max)
Type | Parameter | Default | Description |
---|---|---|---|
number | value | Required parameter | The number to be clamped |
number | min | Required parameter | The min value |
number | max | Required parameter | The max value |
ClampAxis
Clamps an angle to the range of [0, 360]