-
-
Notifications
You must be signed in to change notification settings - Fork 2
Library: Math
While Lua provides a standard math module, it lacks certain advanced mathematical utilities and classes often required in complex applications. This library extends Lua's mathematical capabilities by introducing additional functionality.
It's already imported by default whenever you import assetify
. You need to declare the below globally only once:
loadstring(exports.assetify_library:import())()
ℹ️ Our extensions are designed with backward compatibility in mind; your existing code is expected to function as intended. Nonetheless, we recommend transitioning to newer syntax.
-
✨ Rounds a floating point value by specified decimals.
local float: result = math.round( float: value, int: decimals --Optional: By default its 0 if left unspecified )
-
✨ Retrieves specified percentage of the value.
local float: result = math.percent( float: value, float: percent )
-
✨ Retrieves distance b/w two 2D-Points.
local float: result = math.findDistance2D( float: x1, float: y1, float: x2, float: y2 )
-
✨ Retrieves distance b/w two 3D-Points.
local float: result = math.findDistance3D( float: x1, float: y1, float: z1 float: x2, float: y2, float: z2 )
-
✨ Generates nearest possible rotation b/w two 2D-Points.
local float: result = math.findRotation2D( float: x1, float: y1, float: x2, float: y2 )
-
✨ Generates new coords of an existing 2D-Point after rotating it by specified distance & rotation angle.
local float: result = math.findPointByRotation2D( float: x, float: y, float: distance, float: rotation )