NanosMath
Eine Tabelle mit nützlichen und ergänzenden mathematischen Funktionen.
🎒 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 | |
|---|---|---|---|
| float | Round | Rounds a number to the nearest value with the given decimal places | |
| float | Clamp | Begrenzt eine Zahl | |
| float | ClampAxis | Begrenzt einen Winkel auf den Bereich [0, 360] | |
| float | NormalizeAxis | Begrenzt einen Winkel auf den Bereich [-180, 180] | |
| Vector, Rotator | RelativeTo | Berechnet die Position und Rotation relativ zu einem Akteur | |
| Vector, Rotator | LocalToWorld | Konvertiert eine lokale Position und Rotation basierend auf der Transformation eines Akteurs in Weltkoordinaten | |
| float | RandomFloat | Gibt einen zufälligen Gleitkommawert zurück | |
| float | FInterpTo | Interpoliert eine Zahl von Aktuell zu Ziel | |
| Rotator | RInterpTo | Interpoliert einen Rotator von Aktuell zu Ziel | |
| Rotator | RInterpConstantTo | Interpoliert einen Rotator von Aktuell zu Ziel mit einem konstanten Schritt | |
| Vector | VInterpTo | Interpoliert einen Vektor von Aktuell zu Ziel | |
| Vector | VInterpConstantTo | Interpoliert einen Vektor von Aktuell zu Ziel mit einem konstanten Schritt |
Optimal
Round
Rounds a number to the nearest value with the given decimal places
local ret = NanosMath.Round(value, decimals?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| float | value | Required parameter | Die zu rundende Zahl |
| integer | decimals? | 0 | How many decimal places to keep |
Returns
| Type | Description |
|---|---|
| float | die gerundete Zahl |
Optimal
Clamp
Begrenzt eine Zahl
local ret = NanosMath.Clamp(value, min, max)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| float | value | Required parameter | Die zu begrenzende Zahl |
| float | min | Required parameter | Der Mindestwert |
| float | max | Required parameter | Der Höchstwert |
Returns
| Type | Description |
|---|---|
| float | die begrenzte Zahl |
Optimal
ClampAxis
Begrenzt einen Winkel auf den Bereich [0, 360]
local ret = NanosMath.ClampAxis(value)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| float | value | Required parameter | Die zu begrenzende Zahl |
Returns
| Type | Description |
|---|---|
| float | die begrenzte Zahl |
NanosMath.ClampAxis Examples
Clamping an angle
local axis = NanosMath.ClampAxis(720)
Optimal
NormalizeAxis
Begrenzt einen Winkel auf den Bereich [-180, 180]
local ret = NanosMath.NormalizeAxis(value)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| float | value | Required parameter | Die zu begrenzende Zahl |
Returns
| Type | Description |
|---|---|
| float | die begrenzte Zahl |
Optimal
RelativeTo
Berechnet die Position und Rotation relativ zu einem Akteur
local ret_1, ret_2 = NanosMath.RelativeTo(location, rotation, actor)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | location | Required parameter | Die Position des neuen Systems |
| Rotator | rotation | Required parameter | Die Rotation des neuen Systems |
| Base Actor | actor | Required parameter | Der Akteur, der in das neue System übertragen soll werden |
Optimal
LocalToWorld
Nimmt eine lokale Position und Rotation relativ zu einem Akteur, wendet die Position, Rotation und Skalierung des Akteurs an, um die Weltraum-Position und -Rotation zu berechnen.
local ret_1, ret_2 = NanosMath.LocalToWorld(local_location, local_rotation, actor)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | local_location | Required parameter | Die zu konvertierende lokale Position |
| Rotator | local_rotation | Required parameter | Die zu konvertierende lokale Rotation |
| Base Actor | actor | Required parameter | Der Akteur, dessen Transformation den lokalen Raum definiert |
Optimal
RandomFloat
Gibt einen zufälligen Gleitkommawert zurück
local ret = NanosMath.RandomFloat(min, max)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| float | min | Required parameter | Mindestwert |
| float | max | Required parameter | Höchstwert |
Returns
| Type | Description |
|---|---|
| float | der zufällige Wert |
Optimal
FInterpTo
Interpoliert eine Zahl von Aktuell zu Ziel
local ret = NanosMath.FInterpTo(current, target, delta_time, interp_speed)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| float | current | Required parameter | The current value |
| float | target | Required parameter | The target value |
| float | delta_time | Required parameter | Time since the last call, usually the Tick delta time |
| float | interp_speed | Required parameter | Interpolation speed, 0 jumps straight to the target |
Returns
| Type | Description |
|---|---|
| float | The interpolated value |
NanosMath.FInterpTo Examples
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)
Optimal
RInterpTo
Interpoliert einen Rotator von Aktuell zu Ziel
local ret = NanosMath.RInterpTo(current, target, delta_time, interp_speed)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Rotator | current | Required parameter | The current value |
| Rotator | target | Required parameter | The target value |
| float | delta_time | Required parameter | Time since the last call, usually the Tick delta time |
| float | interp_speed | Required parameter | Interpolation speed, 0 jumps straight to the target |
Returns
| Type | Description |
|---|---|
| Rotator | The interpolated Rotator |
Optimal
RInterpConstantTo
Interpoliert einen Rotator von Aktuell zu Ziel mit einem konstanten Schritt
local ret = NanosMath.RInterpConstantTo(current, target, delta_time, interp_speed)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Rotator | current | Required parameter | The current value |
| Rotator | target | Required parameter | The target value |
| float | delta_time | Required parameter | Time since the last call, usually the Tick delta time |
| float | interp_speed | Required parameter | Interpolation speed, 0 jumps straight to the target |
Returns
| Type | Description |
|---|---|
| Rotator | The interpolated Rotator |
Optimal
VInterpTo
Interpoliert einen Vektor von Aktuell zu Ziel
local ret = NanosMath.VInterpTo(current, target, delta_time, interp_speed)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | current | Required parameter | The current value |
| Vector | target | Required parameter | The target value |
| float | delta_time | Required parameter | Time since the last call, usually the Tick delta time |
| float | interp_speed | Required parameter | Interpolation speed, 0 jumps straight to the target |
Returns
| Type | Description |
|---|---|
| Vector | The interpolated Vector |
NanosMath.VInterpTo Examples
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)
Optimal
VInterpConstantTo
Interpoliert einen Vektor von Aktuell zu Ziel mit einem konstanten Schritt
local ret = NanosMath.VInterpConstantTo(current, target, delta_time, interp_speed)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | current | Required parameter | The current value |
| Vector | target | Required parameter | The target value |
| float | delta_time | Required parameter | Time since the last call, usually the Tick delta time |
| float | interp_speed | Required parameter | Interpolation speed, 0 jumps straight to the target |
Returns
| Type | Description |
|---|---|
| Vector | The interpolated Vector |
