Skip to main content

Kinematics

Basic kinematics calculator that can be used like a spring.

Functions

new

Kinematics.new(
initialT,--

The initial parameter is a number or Vector3 (anything with * number and addition/subtraction).

clock?() → number--

The clock function is optional, and is used to update the kinematics class

) → Kinematics<T>

Constructs a new kinematics class.

local kinematics = Kinematics.new(0)
kinematics.Acceleration = -32
kinematics.Velocity = 10

print(kinematics.Position) --> 0
task.wait(1)
print(kinematics.Position) --> -10

Impulse

Kinematics:Impulse(velocityT) → ()

Impulses the current kinematics object, applying velocity to it.

TimeSkip

Kinematics:TimeSkip(deltanumber) → ()

Skips forward in the set amount of time dictated by delta

SetData

Kinematics:SetData(
startTimenumber,
position0T,
velocity0T,
accelerationT
) → ()

Sets data from some external source

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a new kinematics class.\n\n```lua\nlocal kinematics = Kinematics.new(0)\nkinematics.Acceleration = -32\nkinematics.Velocity = 10\n\nprint(kinematics.Position) --> 0\ntask.wait(1)\nprint(kinematics.Position) --> -10\n```",
            "params": [
                {
                    "name": "initial",
                    "desc": "The initial parameter is a number or Vector3 (anything with * number and addition/subtraction).",
                    "lua_type": "T"
                },
                {
                    "name": "clock?",
                    "desc": "The clock function is optional, and is used to update the kinematics class",
                    "lua_type": "() -> number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Kinematics<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 26,
                "path": "src/kinematics/src/Shared/Kinematics.lua"
            }
        },
        {
            "name": "Impulse",
            "desc": "Impulses the current kinematics object, applying velocity to it.",
            "params": [
                {
                    "name": "velocity",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 45,
                "path": "src/kinematics/src/Shared/Kinematics.lua"
            }
        },
        {
            "name": "TimeSkip",
            "desc": "Skips forward in the set amount of time dictated by `delta`",
            "params": [
                {
                    "name": "delta",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 53,
                "path": "src/kinematics/src/Shared/Kinematics.lua"
            }
        },
        {
            "name": "SetData",
            "desc": "Sets data from some external source",
            "params": [
                {
                    "name": "startTime",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "position0",
                    "desc": "",
                    "lua_type": "T"
                },
                {
                    "name": "velocity0",
                    "desc": "",
                    "lua_type": "T"
                },
                {
                    "name": "acceleration",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 70,
                "path": "src/kinematics/src/Shared/Kinematics.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Kinematics",
    "desc": "Basic kinematics calculator that can be used like a spring.",
    "source": {
        "line": 5,
        "path": "src/kinematics/src/Shared/Kinematics.lua"
    }
}