Skip to main content

HingedModel

Extends AnimationModel

Model that rotates along one axis

Getting the Base CFrame

The "base" CFrame, the CFrame which the model will rotate with the given axis, can be extracted in three ways:

  • If base exists, a PVInstance, the CFrame with be from :GetPivot() method
  • If baseCFrame exists, a CFrame,
  • Finally, if both of the above are nil, uses the CFrame returned from the position and track arguments from :update() by calling track:getCFrame(position).
    • Recommended to be used with a CFrameTrack that is a HingeCFrameTrack or whose root track is a HingeCFrameTrack

Children

{
	ModelType: StringValue, // set to Hinged
	Model: PVInstance, // the hingedModel
	Axis: StringValue, // value can be `X`, `Y`, or `Z`
	Base: ObjectValue<BaseInstance> | PVInstance | CFrameInstance,
	UseNegativeAngle: BoolValue?,
	UseDegrees: BoolValue?,
}

Properties

hingedModel

HingedModel.hingedModel: Model?

The model that will spin along the axis and base. Set during construction

base

HingedModel.base: PVInstance?

If exists, will use the current CFrame (through :GetPivot()) as the base CFrame each update.

baseCFrame

HingedModel.baseCFrame: CFrame?

If exists, will be used as the base CFrame each update.

axis

This item is read only and cannot be modified. Read Only
HingedModel.axis: Enum.Axis

getAxisCFrame

This item is read only and cannot be modified. Read Only
HingedModel.getAxisCFrame: (anglenumber) → CFrame

currentAngle

HingedModel.currentAngle: number

useNegativeAngle

HingedModel.useNegativeAngle: boolean

useDegrees

HingedModel.useDegrees: boolean

Functions

new

Constructor
HingedModel.new(modelModel) → HingedModel

Constructor

getDataFromInstance

HingedModel.getDataFromInstance(modelModel) → Result<HingedModelData,string>

Extracts data from an Instance

create

HingedModel.create(modelModel) → Result<HingedModel,string>

Creates a HingedModel from a Model

setAxis

HingedModel:setAxis(axisEnum.Axis) → ()

Sets the axis

setBase

HingedModel:setBase(basePVInstance) → ()

Sets the base

getBase

HingedModel:getBase() → PVInstance | CFrame | nil

Returns the current base of this HingedModel

setInDefaultPosition

override
HingedModel:setInDefaultPosition() → ()

Sets this model in it's default position This is the position used when it is not updating

update

override
HingedModel:update(
positionnumber,
modelDirectionboolean,
currentTrackCFrameTrack?
) → ()

updateModel

HingedModel:updateModel(currentTrackCFrameTrack?) → ()

Updates the hinged model

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructor",
            "params": [
                {
                    "name": "model",
                    "desc": "",
                    "lua_type": "Model"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "HingedModel"
                }
            ],
            "function_type": "static",
            "tags": [
                "Constructor"
            ],
            "source": {
                "line": 101,
                "path": "src/shared/animationModel/HingedModel.lua"
            }
        },
        {
            "name": "getDataFromInstance",
            "desc": "Extracts data from an Instance",
            "params": [
                {
                    "name": "model",
                    "desc": "",
                    "lua_type": "Model"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Result<HingedModelData, string>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 134,
                "path": "src/shared/animationModel/HingedModel.lua"
            }
        },
        {
            "name": "create",
            "desc": "Creates a HingedModel from a Model",
            "params": [
                {
                    "name": "model",
                    "desc": "",
                    "lua_type": "Model"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Result<HingedModel, string>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 209,
                "path": "src/shared/animationModel/HingedModel.lua"
            }
        },
        {
            "name": "_setData",
            "desc": "Sets the data of this HingedModel",
            "params": [
                {
                    "name": "data",
                    "desc": "",
                    "lua_type": "HingedModelData"
                }
            ],
            "returns": [],
            "function_type": "method",
            "private": true,
            "source": {
                "line": 228,
                "path": "src/shared/animationModel/HingedModel.lua"
            }
        },
        {
            "name": "setAxis",
            "desc": "Sets the axis",
            "params": [
                {
                    "name": "axis",
                    "desc": "",
                    "lua_type": "Enum.Axis"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 240,
                "path": "src/shared/animationModel/HingedModel.lua"
            }
        },
        {
            "name": "setBase",
            "desc": "Sets the base",
            "params": [
                {
                    "name": "base",
                    "desc": "",
                    "lua_type": "PVInstance"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 247,
                "path": "src/shared/animationModel/HingedModel.lua"
            }
        },
        {
            "name": "getBase",
            "desc": "Returns the current base of this HingedModel",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "PVInstance | CFrame | nil"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 269,
                "path": "src/shared/animationModel/HingedModel.lua"
            }
        },
        {
            "name": "setInDefaultPosition",
            "desc": "Sets this model in it's default position\nThis is the position used when it is not updating",
            "params": [],
            "returns": [],
            "function_type": "method",
            "tags": [
                "override"
            ],
            "source": {
                "line": 276,
                "path": "src/shared/animationModel/HingedModel.lua"
            }
        },
        {
            "name": "update",
            "desc": "",
            "params": [
                {
                    "name": "position",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "modelDirection",
                    "desc": "",
                    "lua_type": "boolean"
                },
                {
                    "name": "currentTrack",
                    "desc": "",
                    "lua_type": "CFrameTrack?"
                }
            ],
            "returns": [],
            "function_type": "method",
            "tags": [
                "override"
            ],
            "source": {
                "line": 284,
                "path": "src/shared/animationModel/HingedModel.lua"
            }
        },
        {
            "name": "updateModel",
            "desc": "Updates the hinged model",
            "params": [
                {
                    "name": "currentTrack",
                    "desc": "",
                    "lua_type": "CFrameTrack?"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 297,
                "path": "src/shared/animationModel/HingedModel.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "hingedModel",
            "desc": "The model that will spin along the axis and base.\nSet during construction",
            "lua_type": "Model?",
            "source": {
                "line": 67,
                "path": "src/shared/animationModel/HingedModel.lua"
            }
        },
        {
            "name": "base",
            "desc": "If exists, will use the current CFrame (through `:GetPivot()`) as the base CFrame each update.",
            "lua_type": "PVInstance?",
            "source": {
                "line": 71,
                "path": "src/shared/animationModel/HingedModel.lua"
            }
        },
        {
            "name": "baseCFrame",
            "desc": "If exists, will be used as the base CFrame each update.",
            "lua_type": "CFrame?",
            "source": {
                "line": 75,
                "path": "src/shared/animationModel/HingedModel.lua"
            }
        },
        {
            "name": "axis",
            "desc": "",
            "lua_type": "Enum.Axis",
            "readonly": true,
            "source": {
                "line": 79,
                "path": "src/shared/animationModel/HingedModel.lua"
            }
        },
        {
            "name": "getAxisCFrame",
            "desc": "",
            "lua_type": "(angle: number) -> CFrame",
            "readonly": true,
            "source": {
                "line": 83,
                "path": "src/shared/animationModel/HingedModel.lua"
            }
        },
        {
            "name": "currentAngle",
            "desc": "",
            "lua_type": "number",
            "source": {
                "line": 86,
                "path": "src/shared/animationModel/HingedModel.lua"
            }
        },
        {
            "name": "useNegativeAngle",
            "desc": "",
            "lua_type": "boolean",
            "source": {
                "line": 89,
                "path": "src/shared/animationModel/HingedModel.lua"
            }
        },
        {
            "name": "useDegrees",
            "desc": "",
            "lua_type": "boolean",
            "source": {
                "line": 92,
                "path": "src/shared/animationModel/HingedModel.lua"
            }
        }
    ],
    "types": [],
    "name": "HingedModel",
    "desc": "##### Extends [AnimationModel](/api/AnimationModel)\nModel that rotates along one axis\n### Getting the Base CFrame\nThe \"base\" CFrame, the CFrame which the model will rotate with the given axis, can be extracted in three ways:\n- If `base` exists, a PVInstance, the CFrame with be from `:GetPivot()` method\n- If `baseCFrame` exists, a CFrame,\n- Finally, if both of the above are `nil`, uses the CFrame returned from the position and track arguments from `:update()` by calling `track:getCFrame(position)`.\n\t- Recommended to be used with a CFrameTrack that is a HingeCFrameTrack or whose root track is a HingeCFrameTrack\n### Children\n```ts\n{\n\tModelType: StringValue, // set to Hinged\n\tModel: PVInstance, // the hingedModel\n\tAxis: StringValue, // value can be `X`, `Y`, or `Z`\n\tBase: ObjectValue<BaseInstance> | PVInstance | CFrameInstance,\n\tUseNegativeAngle: BoolValue?,\n\tUseDegrees: BoolValue?,\n}\n```",
    "source": {
        "line": 62,
        "path": "src/shared/animationModel/HingedModel.lua"
    }
}