Skip to main content

CFrameTrain

Defines and calculates positions and offsets along a track for a train

Types

CarCFrames

interface CarCFrames {
chassisCFrame
wheelSetACFrame
wheelSetBCFrame?
}

Properties

length

CFrameTrain.length: number

The total length of the train

baseCFrame

CFrameTrain.baseCFrame: CFrame

cars

CFrameTrain.cars: {CFrameTrainCar}

connectors

CFrameTrain.connectors: {CFrameTrainConnector}

wheelSetOffsets

CFrameTrain.wheelSetOffsets: {number}

wheelSetOffsetsBackwards

CFrameTrain.wheelSetOffsetsBackwards: {number}

Functions

new

Constructor
CFrameTrain.new() → CFrameTrain

Default constructor

fromData

Constructor
CFrameTrain.fromData(datatable) → CFrameTrain

Constructor

fromInstance

Constructor
CFrameTrain.fromInstance(instanceInstance) → Result<CFrameTrain,string>

Constructor

getCarsFromInstance

Static
CFrameTrain.getCarsFromInstance(
instanceInstance,
baseCFrameCFrame
) → Result<{CFrameTrainCar},string>

Extracts cars from an Instance

getConnectorsFromInstance

Static
CFrameTrain.getConnectorsFromInstance(
instanceInstance,
cars{table},
baseCFrameCFrame?
) → Result<{CFrameTrainConnector},string>

Extracts connectors from an Instance

updateWheelSetIndexes

Static
CFrameTrain.updateWheelSetIndexes(cars{CFrameTrainCar}) → ()

Updates the indexes of the wheel sets in the cars

getWheelSetOffsetsFromCars

Static
CFrameTrain.getWheelSetOffsetsFromCars(cars{CFrameTrainCar}) → {number}

Gets the position offsets for the wheelSets

Destroy

Deconstructor
CFrameTrain:Destroy() → ()

Deconstructor

getCFrames

CFrameTrain:getCFrames(wheelSetCFrames{CFrame}) → TrainCFrames

Types

interface TrainCFrames {
cars{CarCFrames}
chassis{[string]CFrame}
}

Calculates the CFrames of each of the train components from the position of it's wheelsets

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Default constructor",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "CFrameTrain"
                }
            ],
            "function_type": "static",
            "tags": [
                "Constructor"
            ],
            "source": {
                "line": 44,
                "path": "src/shared/animationModel/trainModel/cframeTrain/CFrameTrain.lua"
            }
        },
        {
            "name": "fromData",
            "desc": "Constructor",
            "params": [
                {
                    "name": "data",
                    "desc": "",
                    "lua_type": "table"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "CFrameTrain"
                }
            ],
            "function_type": "static",
            "tags": [
                "Constructor"
            ],
            "source": {
                "line": 62,
                "path": "src/shared/animationModel/trainModel/cframeTrain/CFrameTrain.lua"
            }
        },
        {
            "name": "fromInstance",
            "desc": "Constructor",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Result<CFrameTrain, string>"
                }
            ],
            "function_type": "static",
            "tags": [
                "Constructor"
            ],
            "source": {
                "line": 99,
                "path": "src/shared/animationModel/trainModel/cframeTrain/CFrameTrain.lua"
            }
        },
        {
            "name": "getCarsFromInstance",
            "desc": "Extracts cars from an Instance",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "baseCFrame",
                    "desc": "",
                    "lua_type": "CFrame"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Result<{CFrameTrainCar}, string>"
                }
            ],
            "function_type": "static",
            "tags": [
                "Static"
            ],
            "source": {
                "line": 171,
                "path": "src/shared/animationModel/trainModel/cframeTrain/CFrameTrain.lua"
            }
        },
        {
            "name": "getConnectorsFromInstance",
            "desc": "Extracts connectors from an Instance",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "cars",
                    "desc": "",
                    "lua_type": "{ table }"
                },
                {
                    "name": "baseCFrame",
                    "desc": "",
                    "lua_type": "CFrame?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Result<{CFrameTrainConnector}, string>"
                }
            ],
            "function_type": "static",
            "tags": [
                "Static"
            ],
            "source": {
                "line": 272,
                "path": "src/shared/animationModel/trainModel/cframeTrain/CFrameTrain.lua"
            }
        },
        {
            "name": "updateWheelSetIndexes",
            "desc": "Updates the indexes of the wheel sets in the cars",
            "params": [
                {
                    "name": "cars",
                    "desc": "",
                    "lua_type": "{CFrameTrainCar}"
                }
            ],
            "returns": [],
            "function_type": "static",
            "tags": [
                "Static"
            ],
            "source": {
                "line": 342,
                "path": "src/shared/animationModel/trainModel/cframeTrain/CFrameTrain.lua"
            }
        },
        {
            "name": "getWheelSetOffsetsFromCars",
            "desc": "Gets the position offsets for the wheelSets",
            "params": [
                {
                    "name": "cars",
                    "desc": "",
                    "lua_type": "{CFrameTrainCar}"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{number}"
                }
            ],
            "function_type": "static",
            "tags": [
                "Static"
            ],
            "source": {
                "line": 369,
                "path": "src/shared/animationModel/trainModel/cframeTrain/CFrameTrain.lua"
            }
        },
        {
            "name": "Destroy",
            "desc": "Deconstructor",
            "params": [],
            "returns": [],
            "function_type": "method",
            "tags": [
                "Deconstructor"
            ],
            "source": {
                "line": 400,
                "path": "src/shared/animationModel/trainModel/cframeTrain/CFrameTrain.lua"
            }
        },
        {
            "name": "getCFrames",
            "desc": "Calculates the CFrames of each of the train components from the position of it's wheelsets",
            "params": [
                {
                    "name": "wheelSetCFrames",
                    "desc": "",
                    "lua_type": "{CFrame}"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "TrainCFrames"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 436,
                "path": "src/shared/animationModel/trainModel/cframeTrain/CFrameTrain.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "length",
            "desc": "The total length of the train",
            "lua_type": "number",
            "source": {
                "line": 22,
                "path": "src/shared/animationModel/trainModel/cframeTrain/CFrameTrain.lua"
            }
        },
        {
            "name": "baseCFrame",
            "desc": "",
            "lua_type": "CFrame",
            "source": {
                "line": 25,
                "path": "src/shared/animationModel/trainModel/cframeTrain/CFrameTrain.lua"
            }
        },
        {
            "name": "cars",
            "desc": "",
            "lua_type": "{CFrameTrainCar}",
            "source": {
                "line": 28,
                "path": "src/shared/animationModel/trainModel/cframeTrain/CFrameTrain.lua"
            }
        },
        {
            "name": "connectors",
            "desc": "",
            "lua_type": "{CFrameTrainConnector}",
            "source": {
                "line": 31,
                "path": "src/shared/animationModel/trainModel/cframeTrain/CFrameTrain.lua"
            }
        },
        {
            "name": "wheelSetOffsets",
            "desc": "",
            "lua_type": "{number}",
            "source": {
                "line": 34,
                "path": "src/shared/animationModel/trainModel/cframeTrain/CFrameTrain.lua"
            }
        },
        {
            "name": "wheelSetOffsetsBackwards",
            "desc": "",
            "lua_type": "{number}",
            "source": {
                "line": 37,
                "path": "src/shared/animationModel/trainModel/cframeTrain/CFrameTrain.lua"
            }
        }
    ],
    "types": [
        {
            "name": "CarCFrames",
            "desc": "",
            "fields": [
                {
                    "name": "chassis",
                    "lua_type": "CFrame",
                    "desc": ""
                },
                {
                    "name": "wheelSetA",
                    "lua_type": "CFrame",
                    "desc": ""
                },
                {
                    "name": "wheelSetB",
                    "lua_type": "CFrame?",
                    "desc": ""
                }
            ],
            "source": {
                "line": 416,
                "path": "src/shared/animationModel/trainModel/cframeTrain/CFrameTrain.lua"
            }
        },
        {
            "name": "TrainCFrames",
            "desc": "",
            "fields": [
                {
                    "name": "cars",
                    "lua_type": "{CarCFrames}",
                    "desc": ""
                },
                {
                    "name": "chassis",
                    "lua_type": "{[string]: CFrame}",
                    "desc": ""
                }
            ],
            "source": {
                "line": 427,
                "path": "src/shared/animationModel/trainModel/cframeTrain/CFrameTrain.lua"
            }
        }
    ],
    "name": "CFrameTrain",
    "desc": "Defines and calculates positions and offsets along a track for a train",
    "source": {
        "line": 18,
        "path": "src/shared/animationModel/trainModel/cframeTrain/CFrameTrain.lua"
    }
}