Skip to main content

Kinematics

Basic kinematics calculator that can be used like a spring. See Spring also.

Properties

Position

Kinematics.Position: T

Gets and sets the current position of the Kinematics

Velocity

Kinematics.Velocity: T

Gets and sets the current velocity of the Kinematics

Acceleration

Kinematics.Acceleration: T

Gets and sets the acceleration.

StartTime

Kinematics.StartTime: T

Gets and sets the start time.

StartPosition

Kinematics.StartPosition: T

Gets and set the start position

StartVelocity

Kinematics.StartVelocity: T

Sets the start velocity

Speed

Kinematics.Speed: number

Sets the playback speed

Age

This item is read only and cannot be modified. Read Only
Kinematics.Age: number

Returns how old the kinematics is

Clock

Kinematics.Clock: () → number

The current clock object to syncronize the kienmatics against.

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 all at once. This is useful for synchronizing the network.

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": 27,
                "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": 46,
                "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": 54,
                "path": "src/kinematics/src/Shared/Kinematics.lua"
            }
        },
        {
            "name": "SetData",
            "desc": "Sets data from some external source all at once.\nThis is useful for synchronizing the network.",
            "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": 73,
                "path": "src/kinematics/src/Shared/Kinematics.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "Position",
            "desc": "Gets and sets the current position of the Kinematics",
            "lua_type": "T",
            "source": {
                "line": 85,
                "path": "src/kinematics/src/Shared/Kinematics.lua"
            }
        },
        {
            "name": "Velocity",
            "desc": "Gets and sets the current velocity of the Kinematics",
            "lua_type": "T",
            "source": {
                "line": 91,
                "path": "src/kinematics/src/Shared/Kinematics.lua"
            }
        },
        {
            "name": "Acceleration",
            "desc": "Gets and sets the acceleration.",
            "lua_type": "T",
            "source": {
                "line": 97,
                "path": "src/kinematics/src/Shared/Kinematics.lua"
            }
        },
        {
            "name": "StartTime",
            "desc": "Gets and sets the start time.",
            "lua_type": "T",
            "source": {
                "line": 103,
                "path": "src/kinematics/src/Shared/Kinematics.lua"
            }
        },
        {
            "name": "StartPosition",
            "desc": "Gets and set the start position",
            "lua_type": "T",
            "source": {
                "line": 109,
                "path": "src/kinematics/src/Shared/Kinematics.lua"
            }
        },
        {
            "name": "StartVelocity",
            "desc": "Sets the start velocity",
            "lua_type": "T",
            "source": {
                "line": 115,
                "path": "src/kinematics/src/Shared/Kinematics.lua"
            }
        },
        {
            "name": "Speed",
            "desc": "Sets the playback speed",
            "lua_type": "number",
            "source": {
                "line": 121,
                "path": "src/kinematics/src/Shared/Kinematics.lua"
            }
        },
        {
            "name": "Age",
            "desc": "Returns how old the kinematics is",
            "lua_type": "number",
            "readonly": true,
            "source": {
                "line": 128,
                "path": "src/kinematics/src/Shared/Kinematics.lua"
            }
        },
        {
            "name": "Clock",
            "desc": "The current clock object to syncronize the kienmatics against.",
            "lua_type": "() -> number",
            "source": {
                "line": 135,
                "path": "src/kinematics/src/Shared/Kinematics.lua"
            }
        }
    ],
    "types": [],
    "name": "Kinematics",
    "desc": "Basic kinematics calculator that can be used like a spring. See [Spring] also.",
    "source": {
        "line": 6,
        "path": "src/kinematics/src/Shared/Kinematics.lua"
    }
}