Models
Represents a node in the model tree, basically a group/cube/mesh in Blockbench
Each bbmodel file is itself a ModelPart, and all of your models are contained in a global ModelPart called models
This page is a WIP. It contains all the information in Figura's documentation but we're working on adding more helpful descriptions.
Transformations
setVisible()
Aliases: visible()
Sets this part to be visible or invisible
The default value is nil, meaning the part copies its visibility from its parent part
setVisible(visible)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
visible | Boolean | - | - |
Returns:
Type | Description |
---|---|
ModelPart | Returns self for chaining |
Example:
models:setVisible(false)
getVisible()
Gets whether or not this model part is visible
The default value is nil, meaning it copies the visibility of its parent part during rendering
getVisible()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
models:getVisible()
setRot()
Aliases: rot()
Sets the absolute rotation for this part
Nil values for rotation are assumed to be 0
Angles are given in degrees
For relative rotation values, check out the "offset" rot functions
- Overload 1
- Overload 2
Example:
models:setRot(0, 90, 0)
getRot()
Gets the rotation of the model part, including its rotation in Blockbench
For relative rotation values, check out the "offset" rot functions
getRot()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
models:getRot()
setPos()
Aliases: pos()
Sets the position offset for this part from its Blockbench position
Nil values for position are assumed to be 0
- Overload 1
- Overload 2
Example:
models:setPos(0, 5, 0)
getPos()
Gets the position of the model part, as an offset from its position in Blockbench
Only changes from {0,0,0} when you call setPos()
getPos()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
models:getPos()
setScale()
Aliases: scale()
Sets the scale factor for this part
Nil values for scale are assumed to be 1
- Overload 1
- Overload 2
Example:
models:setScale(2, 2, 2)
getScale()
Gets the scale of the model part, as a multiple of its Blockbench size
Only changes from {1,1,1} when you call setScale()
getScale()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
models:getScale()
setPivot()
Aliases: pivot()
Sets the absolute pivot for this part
Nil values are assumed to be 0
For relative pivot offsets, check out the "offset" pivot functions
- Overload 1
- Overload 2
Example:
models:setPivot(0, 5, 0)
getPivot()
Gets the pivot point of the model part, including its pivot in Blockbench
For relative values, check out the "offset" pivot functions
getPivot()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
models:getPivot()
setOffsetRot()
Aliases: offsetRot()
Sets the rotation offset for this part
Nil values for rotation are assumed to be 0
Angles are given in degrees
For absolute rotation values, check out the non-offset rot functions
- Overload 1
- Overload 2
Example:
models:setOffsetRot(0, 90, 0)
getOffsetRot()
Gets the rotation offset of the model part, offset from its rotation in Blockbench
For absolute rotation values, check out the non-offset rot functions
getOffsetRot()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
models:getOffsetRot()
setOffsetScale()
Aliases: offsetScale()
Sets the scale offset for this part
Nil values are assumed to be 1
For absolute scale values, check out the non-offset rot functions
- Overload 1
- Overload 2
Example:
models:setOffsetScale(2, 2, 2)
getOffsetScale()
Gets the scale offset of the model part, offset from its default scale
For absolute scale values, check out the non-offset rot functions
getOffsetScale()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
models:getOffsetScale()
setOffsetPivot()
Aliases: offsetPivot()
Sets the pivot offset point for this part (multiplicative)
Nil values are assumed to be 0
For absolute pivot point values, check out the non-offset pivot functions
- Overload 1
- Overload 2
Example:
models:setOffsetPivot(0, 5, 0)
getOffsetPivot()
Gets the pivot offset of the model part, offset from its pivot in Blockbench
For absolute pivot point values, check out the non-offset pivot functions
getOffsetPivot()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
models:getOffsetPivot()
setMatrix()
Aliases: matrix()
Sets the given matrix as the position matrix for this model part
The normal matrix is automatically calculated as the inverse transpose of this matrix
Calling this DOES NOT CHANGE the values of position, rot, or scale in the model part
If you call setPos() or a similar function, the effects of setMatrix() will be overwritten
setMatrix(matrix)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
matrix | Matrix4 | - | - |
Returns:
Type | Description |
---|---|
ModelPart | Returns self for chaining |
Example:
models:setMatrix(matrices.mat4())
getPositionMatrix()
Recalculates the matrix for this model part, based on its current position, rotation, scale, and pivot, then returns this matrix
getPositionMatrix()
Returns:
Type | Description |
---|---|
Matrix4 | - |
Example:
models:getPositionMatrix()
getPositionMatrixRaw()
Returns the position matrix for this model part
The Raw version of the function is different in that it doesn't recalculate the matrix before getting it
getPositionMatrixRaw()
Returns:
Type | Description |
---|---|
Matrix4 | - |
Example:
models:getPositionMatrixRaw()
getNormalMatrix()
Recalculates the normal matrix for this model part, based on its current position, rotation, scale, and pivot, then returns this matrix
getNormalMatrix()
Returns:
Type | Description |
---|---|
Matrix3 | - |
Example:
models:getNormalMatrix()
getNormalMatrixRaw()
Returns the normal matrix for this model part
The Raw version of the function is different in that it doesn't recalculate the matrix before returning it
getNormalMatrixRaw()
Returns:
Type | Description |
---|---|
Matrix3 | - |
Example:
models:getNormalMatrixRaw()
Part Information
getName()
The name of this model part
getName()
Returns:
Type | Description |
---|---|
String | - |
Example:
models:getName()
getType()
Returns whether this part is a "GROUP", a "CUBE", or a "MESH"
getType()
Returns:
Type | Description |
---|---|
String | - |
Example:
models:getType()
getTrueRot()
Gets the true rotation of this model part, which is a sum of the rotation, the offset rotation and the animation position
getTrueRot()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
models:getTrueRot()
getTruePos()
Gets the true position of this model part, which is a sum of the position and the animation position
getTruePos()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
models:getTruePos()
getTrueScale()
Gets the true scale of this model part, which is a sum of the scale, the offset scale and the animation scale
getTrueScale()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
models:getTrueScale()
getTruePivot()
Gets the true pivot of this model part, which is a sum of the pivot and the offset pivot
getTruePivot()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
models:getTruePivot()
partToWorldMatrix()
Gets a matrix which transforms a point from this part's position to a world location
Recommended to use this in POST_RENDER, as by then the matrix is updated
In RENDER it will be 1 frame behind the part's visual position for that frame
Also, if the model is not rendered in-world, the part's matrix will not be updated
Paperdoll rendering and other UI renderings will not affect this matrix
partToWorldMatrix()
Returns:
Type | Description |
---|---|
Matrix4 | - |
Example:
models:partToWorldMatrix():apply()
Rendering
setPrimaryRenderType()
Aliases: primaryRenderType()
Sets the current primary render type of this model part
Nil by default, meaning the part copies the primary render type of its parent during rendering
Check the docs enum command for all render types
setPrimaryRenderType(renderType)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
renderType | String | - | - |
Returns:
Type | Description |
---|---|
ModelPart | Returns self for chaining |
Example:
models:setPrimaryRenderType("END_PORTAL")
getPrimaryRenderType()
Gets the current primary render type of this model part
Nil by default, meaning the part copies the primary render type of its parent
getPrimaryRenderType()
Returns:
Type | Description |
---|---|
String | - |
Example:
models:getPrimaryRenderType() == "TRANSLUCENT_CULL"
setSecondaryRenderType()
Aliases: secondaryRenderType()
Sets the current secondary render type of this model part
Nil by default, meaning the part copies the secondary render type of its parent during rendering
Check the docs enum command for all render types
setSecondaryRenderType(renderType)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
renderType | String | - | - |
Returns:
Type | Description |
---|---|
ModelPart | Returns self for chaining |
Example:
models:setSecondaryRenderType("GLINT")
getSecondaryRenderType()
Gets the current secondary render type of this model part
Nil by default, meaning the part copies the secondary render type of its parent
getSecondaryRenderType()
Returns:
Type | Description |
---|---|
String | - |
Example:
models:getSecondaryRenderType() == "LINES"
setOpacity()
Aliases: opacity()
Sets the opacity multiplier of this part
Note that opacity settings will only take effect if the part has a suitable Render Type for them, mainly TRANSLUCENT
Check out modelPart.setPrimaryRenderType() for how to do this
setOpacity(opacity)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
opacity | Number | - | - |
Returns:
Type | Description |
---|---|
ModelPart | Returns self for chaining |
Example:
models:setOpacity(0.5)
getOpacity()
Gets the opacity multiplier of this part
Note that opacity settings will only take effect if the part has a suitable Render Type for them, mainly TRANSLUCENT
Check out modelPart.setPrimaryRenderType() for how to do this
getOpacity()
Returns:
Type | Description |
---|---|
Number | - |
Example:
models:getOpacity()
setLight()
Aliases: light()
Sets the light level to be used when rendering this part
Values you give are 0 to 15, indicating the block light and sky light levels you want to use
Passing nil will reset the lighting override for this part
- Overload 1
- Overload 2
Example:
-- Example for mimicking vanilla lighting
local blockLight = world.getBlockLightLevel(player:getPos():add(0, .4, 0))
local skyLight = world.getSkyLightLevel(player:getPos():add(0, .4, 0))
models:setLight(blockLight, skyLight)
getLight()
Gets the light level you set earlier to this part
Does not interact with Minecraft's lighting system, only retrieving values you set earlier with setLight()
getLight()
Returns:
Type | Description |
---|---|
Vector2 | - |
Example:
models:getLight()
setOverlay()
Aliases: overlay()
Sets the overlay color to be used when rendering this part
Values you give are 0 to 15, indicating the white overlay and the damage overlay levels you want to use
Passing nil will reset the overlay override for this part
- Overload 1
- Overload 2
Example:
-- Example for a hurt overlay
local hurt = player:getNbt().HurtTime > 0
models:setOverlay(hurt and 0 or nil, 1)
getOverlay()
Gets the overlay color you set earlier to this part
Does not interact with Minecraft's overlay system, only retrieving values you set earlier with setOverlay()
getOverlay()
Returns:
Type | Description |
---|---|
Vector2 | - |
Example:
models:getOverlay()
setColor()
Aliases: color()
Sets the color multiplier for this part for primary and secondary colors
Values are RGB from 0 to 1
- Overload 1
- Overload 2
Example:
models:setColor(0 / 255, 0 / 255, 255 / 255)
getColor()
Returns the average set color from this part, as adding the primary color with the secondary, then dividing them
Values are RGB from 0 to 1
getColor()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
models:getColor()
setPrimaryColor()
Aliases: primaryColor()
Sets the primary color multiplier for this part
Values are RGB from 0 to 1
- Overload 1
- Overload 2
Example:
models:setPrimaryColor(0 / 255, 0 / 255, 255 / 255)
getPrimaryColor()
Gets the primary color multiplier of this part
Values are RGB from 0 to 1
getPrimaryColor()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
models:getPrimaryColor()
setSecondaryColor()
Aliases: secondaryColor()
Sets the secondary color multiplier for this part
Values are RGB from 0 to 1
- Overload 1
- Overload 2
Example:
models:setSecondaryColor(0 / 255, 0 / 255, 255 / 255)
getSecondaryColor()
Gets the secondary color multiplier of this part
Values are RGB from 0 to 1
getSecondaryColor()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
models:getSecondaryColor()
setPreRender()
Sets a function to run before this part starts being rendered
setPreRender(function)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
function | Function | - | - |
Returns:
Type | Description |
---|---|
ModelPart | Returns self for chaining |
Example:
models:setPreRender(function()
print("PreRender!")
end)
setMidRender()
Sets a function to run during the middle of this part's rendering, after its matrices are calculated
setMidRender(function)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
function | Function | - | - |
Returns:
Type | Description |
---|---|
ModelPart | Returns self for chaining |
Example:
models:setMidRender(function()
print("MidRender!")
end)
setPostRender()
Sets a function to run after this part and its children are rendered
setPostRender(function)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
function | Function | - | - |
Returns:
Type | Description |
---|---|
ModelPart | Returns self for chaining |
Example:
models:setPostRender(function()
print("PostRender!")
end)
Animations
getAnimRot()
Gets the rotation offset provided by the currently active animation of this model part
getAnimRot()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
models:getAnimRot()
getAnimPos()
Gets the position offset provided by the currently active animation of this model part
getAnimPos()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
models:getAnimPos()
getAnimScale()
Gets the scale multiplier provided by the currently active animation of this model part
getAnimScale()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
models:getAnimScale()
overrideVanillaRot()
Returns if this part vanilla rotation is being overridden by an animation
overrideVanillaRot()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
models:overrideVanillaRot()
overrideVanillaPos()
Returns if this part vanilla position is being overridden by an animation
overrideVanillaPos()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
models:overrideVanillaPos()
overrideVanillaScale()
Returns if this part vanilla scale is being overridden by an animation
overrideVanillaScale()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
models:overrideVanillaScale()
Texturing
setPrimaryTexture()
Aliases: primaryTexture()
Sets the primary texture override of this part
Check the TextureType types in the list docs
If using "resource", the second parameter should indicate the path to the Minecraft texture you want to use
If using "custom", the second parameter should indicate a texture object
- Overload 1
- Overload 2
- Overload 3
Example:
-- Vanilla Skin
models:setPrimaryTexture("Skin")
-- Custom Texture
models:setPrimaryTexture("Custom", textures["myTexture"])
-- Minecraft Resource
models:setPrimaryTexture("Resource", "textures/entity/pig/pig.png")
getPrimaryTexture()
Gets the primary texture of this part
Returns two values, first being the override type, second being the texture object, if any.
getPrimaryTexture()
Returns:
Type | Description |
---|---|
TextureType | Override type |
String or Texture | Primary texture |
Example:
local texType, tex = models:getPrimaryTexture() -- this saves both of the potential returns to two variables in a single line of code
log(textType, tex)
getPrimaryDefinedTextures()
Gets the primary textures of this part
Returns a table of each texture for the specified face.
getPrimaryDefinedTextures()
Returns:
Type | Description |
---|---|
AnyType | - |
Example:
models:getPrimaryDefinedTextures()
setSecondaryTexture()
Aliases: secondaryTexture()
Sets the secondary texture override of this part
Check the TextureType types in the list docs
If using "resource", the second parameter should indicate the path to the Minecraft texture you want to use
If using "custom", the second parameter should indicate a texture object
- Overload 1
- Overload 2
- Overload 3
setSecondaryTexture(textureType)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
textureType | String | - | - |
Returns:
Type | Description |
---|---|
ModelPart | Returns self for chaining |
Example:
-- Vanilla Skin
models:setSecondaryTexture("Skin")
-- Custom Texture
models:setSecondaryTexture("Custom", textures["myTexture"])
-- Minecraft Resource
models:setSecondaryTexture("Resource", "textures/entity/pig/pig.png")
getSecondaryTexture()
Gets the secondary texture of this part
Returns two values, first being the override type, second being the value, if any.
getSecondaryTexture()
Returns:
Type | Description |
---|---|
TextureType | Override type |
String or Texture | Secondary texture |
Example:
local texType, tex = models:getSecondaryTexture()
getSecondaryDefinedTextures()
Gets the secondary textures of this part
Returns a table of each texture for the specified face.
getSecondaryDefinedTextures()
Returns:
Type | Description |
---|---|
AnyType | - |
Example:
models:getSecondaryDefinedTextures()
getTextures()
This function is currently bugged, but it is mainly useless anyway
Returns a table with all textures used by this part
Does not include children textures, so groups usually will return an empty table
getTextures()
Returns:
Type | Description |
---|---|
Table | - |
Example:
models:getTextures()
getTextureSize()
Gets the width, height of this part's texture in pixels
Throws an error if this part has multiple different-sized textures on it, or if the part is a Group
getTextureSize()
Returns:
Type | Description |
---|---|
Vector2 | - |
Example:
models:getTextureSize()
setUV()
Aliases: uv()
Sets the UV of this part
This function is normalized, meaning it works with values 0 to 1
If you say setUV(0.5, 0.25), for example, it will scroll by half of your texture width to the right, and one-fourth of the texture width downwards
- Overload 1
- Overload 2
Example:
models:setUV(0.5, 0.5)
getUV()
Gets the UV of this part
This function is normalized, meaning it will return values between 0 to 1
getUV()
Returns:
Type | Description |
---|---|
Vector2 | - |
Example:
models:getUV()
setUVPixels()
Aliases: uvPixels()
Sets the UV of this part in pixels
Automatically divides by the results of getTextureSize(), so you can just input the number of pixels you want the UV to scroll by
Errors if the part has multiple different-sized textures
If this part is a Group, it will attempt to setUVPixels on its children
- Overload 1
- Overload 2
Example:
models:setUVPixels(16.16)
getUVPixels()
Gets the UV of this part
Automatically multiplies the result by getTextureSize()
Errors if the part has multiple different-sized textures of if the part is a Group
getUVPixels()
Returns:
Type | Description |
---|---|
Vector2 | - |
Example:
models:getUVPixels()
setUVMatrix()
Aliases: uvMatrix()
Sets the UV matrix of this part
This matrix is applied to all UV points during the transform, with the UVs treated as homogeneous vectors
setUV() and setUVPixels() are just simpler ways of setting this matrix
setUVMatrix(matrix)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
matrix | Matrix3 | - | - |
Returns:
Type | Description |
---|---|
ModelPart | Returns self for chaining |
Example:
models:setUVMatrix(matrices.mat3())
getUVMatrix()
Gets the UV matrix of this part
getUVMatrix()
Returns:
Type | Description |
---|---|
Matrix3 | - |
Example:
models:getUVMatrix()
Render Tasks
newText()
Adds a new Text Render Task on this part
newText(taskName)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
taskName | String | - | - |
Returns:
Type | Description |
---|---|
TextTask | - |
Example:
models:newText("Example")
newEntity()
Adds a new Entity Render Task on this part
newEntity(taskName)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
taskName | String | - | - |
Returns:
Type | Description |
---|---|
EntityTask | - |
Example:
models:newEntity("Example")
newItem()
Adds a new Item Render Task on this part
newItem(taskName)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
taskName | String | - | - |
Returns:
Type | Description |
---|---|
ItemTask | - |
Example:
models:newItem("Example")
newBlock()
Adds a new Block Render Task on this part
newBlock(taskName)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
taskName | String | - | - |
Returns:
Type | Description |
---|---|
BlockTask | - |
Example:
models:newBlock("Example")
newSprite()
Adds a new Sprite Render Task on this part
newSprite(taskName)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
taskName | String | - | - |
Returns:
Type | Description |
---|---|
SpriteTask | - |
Example:
models:newSprite("Example")
addTask()
Adds the given Render Task on this part
addTask(renderTask)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
renderTask | RenderTask | - | - |
Returns:
Type | Description |
---|---|
RenderTask | - |
Example:
local myItem = models:newItem("foo")
myItem:setItem("slime_ball")
models.model.root.Head:addTask(myItem)
getTask()
Gets the Render Task with the given name from this part
Returns a table with all tasks if a name is not given
- Overload 1
- Overload 2
getTask(taskName)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
taskName | String | - | - |
Returns:
Type | Description |
---|---|
RenderTask | - |
Example:
models:getTask()
removeTask()
Removes the Task with the given name from this part
Removes ALL tasks if a name is not given
- Overload 1
- Overload 2
- Overload 3
removeTask(taskName)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
taskName | String | - | - |
Returns:
Type | Description |
---|---|
ModelPart | Returns self for chaining |
removeTask(renderTask)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
renderTask | RenderTask | - | - |
Returns:
Type | Description |
---|---|
ModelPart | Returns self for chaining |
Example:
models:removeTask()
Misc
setParentType()
Aliases: parentType()
Sets the parent type of the part
See the ParentType parts in the list docs for legal types
setParentType(parentType)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parentType | String | - | - |
Returns:
Type | Description |
---|---|
ModelPart | Returns self for chaining |
Example:
models:setParentType("Head")
getParentType()
Returns the current parent type of the part
getParentType()
Returns:
Type | Description |
---|---|
String | - |
Example:
models:getParentType()
getVertices()
Return a table with all vertices from the given texture id
Returns nil if no vertices were found
getVertices(textureID)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
textureID | String | - | - |
Returns:
Type | Description |
---|---|
Table | - |
Example:
models:getVertices("myTexture")
getAllVertices()
Return a table of all texture ids and their vertices
getAllVertices()
Returns:
Type | Description |
---|---|
Table | - |
Example:
models:getAllVertices()
getParent()
Gets the parent part of this part
If this part has no parent, returns nil
getParent()
Returns:
Type | Description |
---|---|
ModelPart | Returns self for chaining |
Example:
models:getParentType()
remove()
Removes this part from the parent model part
remove()
Returns:
Type | Description |
---|---|
ModelPart | Returns self for chaining |
Example:
-- halloween costume in one line!
models.model.root.Head:remove()
getChildren()
Gets the children of this part, stored in a table
getChildren()
Returns:
Type | Description |
---|---|
Table | - |
Example:
models:getChildren()
isChildOf()
Checks if this part is a child of the given part
isChildOf(part)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
part | ModelPart | - | - |
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
models:isChildOf(models)
moveTo()
Moves this part to be a child of the given part
moveTo(part)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
part | ModelPart | - | - |
Returns:
Type | Description |
---|---|
ModelPart | Returns self for chaining |
Example:
models:moveTo(models)
-- This is recursive
addChild()
Adds the given part into this part's children list
addChild(part)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
part | ModelPart | - | - |
Returns:
Type | Description |
---|---|
ModelPart | Returns self for chaining |
Example:
models:addChild(models)
-- This is recursive
removeChild()
Removes the given part from this part's children list
removeChild(part)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
part | ModelPart | - | - |
Returns:
Type | Description |
---|---|
ModelPart | Returns self for chaining |
Example:
models:removeChild(models)
-- This is recursive
copy()
Returns a copy of this part, with all customizations and vertices copied
Children parts are passed as reference, in a new list
copy(name)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name | String | - | - |
Returns:
Type | Description |
---|---|
ModelPart | Returns self for chaining |
Example:
models:copy("Example")
newPart()
Creates a new, empty, group model part as a child of this part, at the same pivot point
Takes two arguments, the new part's name, and optionally its parent type
- Overload 1
- Overload 2
Example:
-- Example with same parent type
models:newPart("Example")
-- Example with different parent type
models:newPart("Example", "Head")
Fields
preRender
Function to run before this part starts being rendered
midRender
Function to run during the middle of this part's rendering, after its matrices are calculated
postRender
Function to run after this part and its children are rendered