Skip to main content
Version: latest - a1.7.0 βš–οΈ

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​

ReturnsNameDescription
numberRoundRounds a number
numberClamp
numberClampAxisClamps an angle to the range of [0, 360]
numberNormalizeAxisClamps an angle to the range of [-180, 180]
numberFInterpToInterpolate number from Current to Target
RotatorRInterpToInterpolate Rotator from Current to Target
RotatorRInterpConstantToInterpolate Rotator from Current to Target with a constant step
VectorVInterpToInterpolate Vector from Current to Target
VectorVInterpConstantToInterpolate Vector from Current to Target with a constant step

Round​

Rounds a number

NanosMath.Round(value)
TypeParameterDescription
numbervalue

Clamp​

Clamps a number

NanosMath.Clamp(value, min, max)
TypeParameterDescription
numbervalue
numbermin
numbermax

ClampAxis​

Clamps an angle to the range of [0, 360].

NanosMath.ClampAxis(value)
TypeParameterDescription
numbervalue

NormalizeAxis​

Clamps an angle to the range of [-180, 180].

NanosMath.NormalizeAxis(value)
TypeParameterDescription
numbervalue

FInterpTo​

Interpolate scalar from Current to Target

NanosMath.FInterpTo(current, target, delta_time, interp_speed)
TypeParameterDescription
numbercurrent
numbertarget
numberdelta_time
numberinterp_speed

RInterpTo​

Interpolate Rotator from Current to Target

NanosMath.RInterpTo(current, target, delta_time, interp_speed)
TypeParameterDescription
Rotatorcurrent
Rotatortarget
numberdelta_time
numberinterp_speed

RInterpConstantTo​

Interpolate Rotator from Current to Target with a constant step

NanosMath.RInterpConstantTo(current, target, delta_time, interp_speed)
TypeParameterDescription
Rotatorcurrent
Rotatortarget
numberdelta_time
numberinterp_speed

VInterpTo​

Interpolate Vector from Current to Target

NanosMath.VInterpTo(current, target, delta_time, interp_speed)
TypeParameterDescription
Vectorcurrent
Vectortarget
numberdelta_time
numberinterp_speed

VInterpConstantTo​

Interpolate Vector from Current to Target with a constant step

NanosMath.VInterpConstantTo(current, target, delta_time, interp_speed)
TypeParameterDescription
Vectorcurrent
Vectortarget
numberdelta_time
numberinterp_speed