<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.figuramc.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=KitCat962</id>
	<title>FiguraMC - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.figuramc.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=KitCat962"/>
	<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php/Special:Contributions/KitCat962"/>
	<updated>2026-05-29T17:15:39Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=803</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=803"/>
		<updated>2024-12-14T03:52:06Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: syntax spacing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into a ModelPart.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
{{note|&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; itself is a ModelPart. This allows you to apply transformations to the entire model, using e.g. &amp;lt;code&amp;gt;models:setScale(0.5)&amp;lt;/code&amp;gt;.|tag=Trivia|color=#A155DA}}&lt;br /&gt;
&lt;br /&gt;
Take below for example:&lt;br /&gt;
{{tree|icon=BBModel.png|content=&amp;lt;code&amp;gt;model.bbmodel&amp;lt;/code&amp;gt;|inner=&lt;br /&gt;
{{tree|icon=BBGroup.png|content=root|inner=&lt;br /&gt;
{{tree|icon=BBGroup.png|content=Head|inner=&lt;br /&gt;
{{tree|icon=BBCube.png|content=Head}}&lt;br /&gt;
{{tree|icon=BBCube.png|content=HeadLayer}}&lt;br /&gt;
}}&lt;br /&gt;
{{tree|icon=BBGroup.png|content=RightArm|inner=&lt;br /&gt;
{{tree|icon=BBCube.png|content=RightArm}}&lt;br /&gt;
{{tree|icon=BBCube.png|content=RightArmLayer}}&lt;br /&gt;
}}&lt;br /&gt;
{{tree|icon=BBCube.png|content=Super Mega Awesome Thing}}&lt;br /&gt;
}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The way to access the {{Emoji|BBCube.png}} RightArm cube would be the following:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;RightArm&amp;quot;][&amp;quot;RightArm&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.RightArm.RightArm&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awesome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be indexed with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awesome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ParentTypes ==&lt;br /&gt;
In Figura, a [[ParentType]] is applied to a ModelPart causing the ModelPart to behave in a predefined way. This behavior includes acting as a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, or parrots, and binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a case-sensitive ParentType.&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType which can cause unintended behavior!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as [[ParentType/Hud|&amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules]]. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart properties ===&lt;br /&gt;
Read-only properties of a ModelPart&lt;br /&gt;
&lt;br /&gt;
==== getName ====&lt;br /&gt;
----&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getType ====&lt;br /&gt;
----&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their face data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Editing ModelPart hierarchy ===&lt;br /&gt;
Methods relating to getting other ModelParts and manipulating the ModelPart tree&lt;br /&gt;
&lt;br /&gt;
==== getParent ====&lt;br /&gt;
----&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|ModelPart|?}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getChildren ====&lt;br /&gt;
----&lt;br /&gt;
Returns an array containing all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart|[]}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
printTable(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== isChildOf ====&lt;br /&gt;
----&lt;br /&gt;
Recursively checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== copy ====&lt;br /&gt;
----&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setParentType|setParentType]],, [[#getParentType|getParentType]],&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children because it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#getName|getName]],, [[#getChildren|getChildren]],, [[#addChild|addChild]],, [[#removeChild|removeChild]],&lt;br /&gt;
&lt;br /&gt;
==== addChild ====&lt;br /&gt;
----&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#copy|copy]],, [[#setPos|setPos]],&lt;br /&gt;
&lt;br /&gt;
==== removeChild ====&lt;br /&gt;
----&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== remove ====&lt;br /&gt;
----&lt;br /&gt;
Removes this ModelPart from the parent&#039;s child list. Returns self&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;remove()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:remove() -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
models.model.root.LeftLeg:addChild(head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#addChild|addChild]],&lt;br /&gt;
&lt;br /&gt;
=== Manipulation ===&lt;br /&gt;
Methods relating to manipulating the ModelPart within physical space&lt;br /&gt;
&lt;br /&gt;
==== setPos ====&lt;br /&gt;
----&lt;br /&gt;
Sets the offset of the the position of the ModelPart. Position translation applies on the local rotation axis.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(pos {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Move 10 units on the local y axis&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getPos ====&lt;br /&gt;
----&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,10,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setPos|setPos]],&lt;br /&gt;
&lt;br /&gt;
==== setRot ====&lt;br /&gt;
----&lt;br /&gt;
Sets the rotation of the ModelPart. Rotates the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Rotate 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setRot(0, 45, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getRot ====&lt;br /&gt;
----&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;. Will be the Rotation values defined in BlockBench when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0) -- Most ModelParts will not have a rotation set in blockbench&lt;br /&gt;
head:setRot(45, 0, 0)&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setRot|setRot]],&lt;br /&gt;
&lt;br /&gt;
==== setScale ====&lt;br /&gt;
----&lt;br /&gt;
Sets the scale of the ModelPart. Scales the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Squishes and stretches the entire model&lt;br /&gt;
models.model:setScale(1.5, 0.75, 1.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getScale ====&lt;br /&gt;
----&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setScale|setScale]],&lt;br /&gt;
&lt;br /&gt;
==== setPivot ====&lt;br /&gt;
----&lt;br /&gt;
Sets the pivot point of the ModelPart. &#039;&#039;This overrides the pivot point defined in blockbench.&#039;&#039; It is recommended to use [[#setOffsetPivot|setOffsetPivot]], instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- For a normal size humanoid model, the Head&#039;s pivot point is usually at 0,24,0&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setPivot(0, 28, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getPivot ====&lt;br /&gt;
----&lt;br /&gt;
Returns the Pivot Point defined in BlockBench, or the value set by &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; if it was already overwritten.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- The Head group&#039;s pivot point for a humanoid model is usually at 0,24,0&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,24,0)&lt;br /&gt;
head:setPivot(0,0,0)&lt;br /&gt;
-- We have completely ruined the rendering of this ModelPart&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setPivot|setPivot]],&lt;br /&gt;
&lt;br /&gt;
==== setOffsetRot ====&lt;br /&gt;
----&lt;br /&gt;
Sets a rotation value that will be added to the ModelPart&#039;s rotation.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- ModelParts inherit their rotation from blockbench. The Head usually has a rotation of 0,0,0 for consistency with the vanilla model&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
-- Set the offset to 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setOffsetRot(0, 45, 0)&lt;br /&gt;
-- The original rotation is unchanged.&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&lt;br /&gt;
-- setOffsetRot is not additive.&lt;br /&gt;
head:setOffsetRot(0, 25, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,25,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#getRot|getRot]], [[#getOffsetRot|getOffsetRot]],&lt;br /&gt;
&lt;br /&gt;
==== getOffsetRot ====&lt;br /&gt;
----&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;. Will be 0,0,0 when the script begins&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetRot(45, 0, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOffsetRot|setOffsetRot]],&lt;br /&gt;
&lt;br /&gt;
==== setOffsetScale ====&lt;br /&gt;
----&lt;br /&gt;
Sets a scale value that will be multiplied with the ModelPart&#039;s scale.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Half the size of the head&lt;br /&gt;
head:setOffsetScale(0.5)&lt;br /&gt;
-- Results in no changes&lt;br /&gt;
-- I have no idea what this is used for&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getOffsetScale ====&lt;br /&gt;
----&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setOffsetScale(2)&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOffsetScale|setOffsetScale]],&lt;br /&gt;
&lt;br /&gt;
==== setOffsetPivot ====&lt;br /&gt;
----&lt;br /&gt;
Sets a value that will be added to the ModelPart&#039;s pivot point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube and offset the pivot up by 4,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setOffsetPivot(0, 4, 0)&lt;br /&gt;
-- Notice that we did not need to know the original pivot point to do this&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getOffsetPivot ====&lt;br /&gt;
----&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetPivot(0,4,0)&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,4,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOffsetPivot|setOffsetPivot]],&lt;br /&gt;
&lt;br /&gt;
==== setMatrix ====&lt;br /&gt;
----&lt;br /&gt;
Allows you to manually define the matrix used for positioning this ModelPart. Returns self for method chaining.&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt; will undo &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;getPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;getOffsetPivot&amp;lt;/code&amp;gt; will return invalid values while &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt; is in effect. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;getTruePos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueScale&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;getTruePivot&amp;lt;/code&amp;gt; are probably also affected, but nobody tested them yet.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setMatrix(matrix {{type|Matrix4}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTruePos ====&lt;br /&gt;
----&lt;br /&gt;
Returns the position after all calculations are done. This includes &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt; and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTrueRot ====&lt;br /&gt;
----&lt;br /&gt;
Returns the rotation after all calculations are done. This includes &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTrueScale ====&lt;br /&gt;
----&lt;br /&gt;
Returns the scale after all calculations are done. This includes &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTrueScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTruePivot ====&lt;br /&gt;
----&lt;br /&gt;
Returns the pivot point after all calculations are done. This includes &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visual manipulation ===&lt;br /&gt;
Methods relating to modifying how a ModelPart looks&lt;br /&gt;
&lt;br /&gt;
todo: put anything related to renderType, textures, and other visual modifications in here&lt;br /&gt;
&lt;br /&gt;
==== setVisible ====&lt;br /&gt;
----&lt;br /&gt;
Sets if this ModelPart is visible or not. Children of this ModelPart will also be invisible while this part is invisible.&lt;br /&gt;
&lt;br /&gt;
A value of &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; is interpreted as &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; on 0.1.4 and below, and &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; on 0.1.5 and above. This message will disappear &amp;lt;s&amp;gt;if&amp;lt;/s&amp;gt; when 0.1.6 is released.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setVisible(visible {{type|boolean}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
head:setVisible(false) -- Bye bye Head!&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getVisible ====&lt;br /&gt;
----&lt;br /&gt;
Recursively goes up the ModelPart tree until it finds a ModelPart that is invisible, or the ModelPart is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other words, if a parent part is invisible, this function returns &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;. If all parent parts are visible, this function will return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Kinda stupid. This is fixed in 0.1.5 to never return &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool|?}} {{until|0.1.5}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool}} {{since|0.1.5}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; nil --&amp;lt; this is stupid&lt;br /&gt;
root:setVisible(false) -- Bye bye root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; false&lt;br /&gt;
root:setVisible(true) -- Welcome back root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; true --&amp;lt; aaaaaaaa&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== setColor ====&lt;br /&gt;
----&lt;br /&gt;
Sets a value to multiply with all pixels on the ModelPart&#039;s texture. Children of this ModelPart inherit the color, multiplied with their own.&lt;br /&gt;
&lt;br /&gt;
1,1,1 multiplies all color channels by 1, resulting in the texture unchanged. 0,0,0 results in all channels being black.&lt;br /&gt;
&lt;br /&gt;
Expects values between 0 and 1. Numbers larger than 1 results in undocumented behaviour. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If only &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is defined as a number and both &amp;lt;code&amp;gt;g&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; are omitted, &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is used for all 3 color channels.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(color {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(colorAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(r {{type|number}}, g {{type|number}}, b {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Darken the entire model&lt;br /&gt;
root:setColor(0.5,0.5,0.5)&lt;br /&gt;
-- Tint the Head red by reducing the other color channels.&lt;br /&gt;
-- Color is inherited from parents, so the effective color is (0.5, 0.45, 0.45)&lt;br /&gt;
root.Head:setColor(1,0.7,0.7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- If you want to &#039;reset&#039; a child&#039;s color value, extra work is needed.&lt;br /&gt;
&lt;br /&gt;
-- Color is max red&lt;br /&gt;
local color = vec(1,0,0)&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- root has color&lt;br /&gt;
root:setColor(color)&lt;br /&gt;
-- Through magic and wizardry, this &#039;resets&#039; the color of Head back to white, dispite it&#039;s parent having a non-white color&lt;br /&gt;
root.Head:setColor(-color + 2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getColor ====&lt;br /&gt;
----&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setColor&amp;lt;/code&amp;gt;. Returns 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getColor()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
root:setColor(0.5)&lt;br /&gt;
print(root:getColor()) --&amp;gt; (0.5, 0.5, 0.5)&lt;br /&gt;
root.Head:setColor(1,0.7,0.7)&lt;br /&gt;
// getColor is not recursive&lt;br /&gt;
print(root.Head:getColor()) --&amp;gt; (1, 0.7, 0.7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setColor|setColor]],&lt;br /&gt;
&lt;br /&gt;
==== setOpacity ====&lt;br /&gt;
----&lt;br /&gt;
Sets the opacity of the ModelPart. Children of this ModelPart inherit the opacity, multiplied with their own.&lt;br /&gt;
&lt;br /&gt;
Minecraft has a minimum visible opacity of 0.1. Opacity values lower than 0.1 will not render at all. Needs verification.&lt;br /&gt;
&lt;br /&gt;
Only supported on [[RenderType|RenderTypes]] that support translucency. The default primary RenderType is &amp;lt;code&amp;gt;TRANSLUCENT&amp;lt;/code&amp;gt;, so most don&#039;t have to worry about it.&lt;br /&gt;
&lt;br /&gt;
Expects a value between 0 and 1.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOpacity(opacity {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Half opacity&lt;br /&gt;
root:setOpacity(0.5)&lt;br /&gt;
-- Half of half opacity&lt;br /&gt;
root.Head:setColor(0.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getOpacity ====&lt;br /&gt;
----&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setOpacity&amp;lt;/code&amp;gt;. Returns 1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOpacity()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|number}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
root:setOpacity(0.5)&lt;br /&gt;
print(root:getOpacity()) --&amp;gt; 0.5&lt;br /&gt;
root.Head:setOpacity(0.5)&lt;br /&gt;
// getOpacity is not recursive&lt;br /&gt;
print(root.Head:getOpacity()) --&amp;gt; 0.5&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOpacity|setOpacity]],&lt;br /&gt;
&lt;br /&gt;
==== setLight ====&lt;br /&gt;
----&lt;br /&gt;
Overrides the lightlevels used to render the ModelPart. Children of this ModelPart inherit the lightlevel.&lt;br /&gt;
&lt;br /&gt;
Expects 2 values between 0 and 15, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Providing &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; will undo the override, allowing Minecraft to control the lightlevel again.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setLight(light {{type|Vector2|?}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setLight(blockLight {{type|integer|?}}, skyLight {{type|integer|?}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Max light&lt;br /&gt;
root:setLight(15, 15)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- set light based on position (This is a fix for broken lighting on World parts)&lt;br /&gt;
function events.tick()&lt;br /&gt;
  local pos = player:getPos()&lt;br /&gt;
  local blockLight = world.getBlockLightLevel(pos)&lt;br /&gt;
  local skyLight = world.getSkyLightLevel(pos)&lt;br /&gt;
  root:setLight(blockLight, skyLight)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[PlayerAPI#PlayerAPI:getPos|player:getPos]] [[WorldAPI#WorldAPI.getBlockLightLevel|world.getBlockLightLevel]] [[WorldAPI#WorldAPI.getSkyLightLevel|world.getSkyLightLevel]]&lt;br /&gt;
&lt;br /&gt;
==== getLight ====&lt;br /&gt;
----&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setLight&amp;lt;/code&amp;gt;. Returns &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getLight()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector2}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
&lt;br /&gt;
print(root:getLight()) --&amp;gt; nil&lt;br /&gt;
&lt;br /&gt;
root:setLight(12, 8)&lt;br /&gt;
&lt;br /&gt;
let light = root:getLight()&lt;br /&gt;
print(light) --&amp;gt; vec(12, 8)&lt;br /&gt;
print(&amp;quot;BlockLightLevel -&amp;gt; &amp;quot;, light.x) --&amp;gt; &amp;quot;BlockLightLevel -&amp;gt; 12&amp;quot;&lt;br /&gt;
print(&amp;quot;SkyLightLevel -&amp;gt; &amp;quot;, light.y) --&amp;gt; &amp;quot;BlockLightLevel -&amp;gt; 8&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setLight|setLight]],&lt;br /&gt;
&lt;br /&gt;
==== setOverlay ====&lt;br /&gt;
----&lt;br /&gt;
Overrides the values used for rendering the red damage tint and the white creeper fuse effect. Really only useful for preventing the damage overlay from rendering on stuff like armor.&lt;br /&gt;
&lt;br /&gt;
Valid values for whiteOverlay: 0-15&lt;br /&gt;
&lt;br /&gt;
Valid values for hurtOverlay: 0-7&lt;br /&gt;
&lt;br /&gt;
whiteOverlay is a gradually increasing white tint from 0 - 15&lt;br /&gt;
&lt;br /&gt;
hurtOverlay is an unchanging red tint from 0 - 7.&lt;br /&gt;
&lt;br /&gt;
When set, hurtOverlay overrides whiteOverlay. For whiteOverlay to not be overriden, hurtOverlay needs to be 8 or more.&lt;br /&gt;
&lt;br /&gt;
Providing &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; will undo the override, allowing Minecraft to control the overlay again.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOverlay(overlayVector {{type|Vector2|?}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOverlay(whiteOverlay {{type|integer|?}}, hurtOverlay {{type|integer}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Damage overlay&lt;br /&gt;
root:setOverlay(0, 0)&lt;br /&gt;
-- Literally no difference&lt;br /&gt;
root:setOverlay(0, 5)&lt;br /&gt;
root:setOverlay(0, 7)&lt;br /&gt;
&lt;br /&gt;
-- Doesnt work. Damage overlay overrides white&lt;br /&gt;
root:setOverlay(15, 0)&lt;br /&gt;
&lt;br /&gt;
-- This works. Max white overlay&lt;br /&gt;
root:setOverlay(15, 15)&lt;br /&gt;
&lt;br /&gt;
-- This can be used to for preventing the damage overlay on armor&lt;br /&gt;
root:setOverlay(0, 15)&lt;br /&gt;
&lt;br /&gt;
-- Give control back to Minecraft&lt;br /&gt;
root:setOverlay(nil)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getOverlay ====&lt;br /&gt;
----&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setOverlay&amp;lt;/code&amp;gt;. Returns &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOverlay()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector2}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
&lt;br /&gt;
print(root:getOverlay()) --&amp;gt; nil&lt;br /&gt;
&lt;br /&gt;
root:setOverlay(8, 15)&lt;br /&gt;
&lt;br /&gt;
let overlay = root:getOverlay()&lt;br /&gt;
print(overlay) --&amp;gt; vec(8, 15)&lt;br /&gt;
print(&amp;quot;whiteOverlay -&amp;gt; &amp;quot;, overlay.x) --&amp;gt; &amp;quot;whiteOverlay -&amp;gt; 8&amp;quot;&lt;br /&gt;
print(&amp;quot;hurtOverlay -&amp;gt; &amp;quot;, overlay.y) --&amp;gt; &amp;quot;hurtOverlay -&amp;gt; 15&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOverlay|setOverlay]],&lt;br /&gt;
&lt;br /&gt;
=== renderTasks ===&lt;br /&gt;
todo: put all rendertask functions in here &lt;br /&gt;
&lt;br /&gt;
=== Render methods ===&lt;br /&gt;
todo: Put partToWorldMatrix, preRender, midRender, and PostRender in here&lt;br /&gt;
&lt;br /&gt;
=== Animation methods ===&lt;br /&gt;
todo: put getAnimPos/Rot/Scale and overrideVanillaPos/Rot/Scale in here&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
{{Navbox documentation}}&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=802</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=802"/>
		<updated>2024-12-14T03:49:54Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: Grammer&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into a ModelPart.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
{{note|&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; itself is a ModelPart. This allows you to apply transformations to the entire model, using e.g. &amp;lt;code&amp;gt;models:setScale(0.5)&amp;lt;/code&amp;gt;.|tag=Trivia|color=#A155DA}}Take below for example:{{tree|icon=BBModel.png|content=&amp;lt;code&amp;gt;model.bbmodel&amp;lt;/code&amp;gt;|inner=&lt;br /&gt;
{{tree|icon=BBGroup.png|content=root|inner=&lt;br /&gt;
{{tree|icon=BBGroup.png|content=Head|inner=&lt;br /&gt;
{{tree|icon=BBCube.png|content=Head}}&lt;br /&gt;
{{tree|icon=BBCube.png|content=HeadLayer}}&lt;br /&gt;
}}&lt;br /&gt;
{{tree|icon=BBGroup.png|content=RightArm|inner=&lt;br /&gt;
{{tree|icon=BBCube.png|content=RightArm}}&lt;br /&gt;
{{tree|icon=BBCube.png|content=RightArmLayer}}&lt;br /&gt;
}}&lt;br /&gt;
{{tree|icon=BBCube.png|content=Super Mega Awesome Thing}}&lt;br /&gt;
}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The way to access the {{Emoji|BBCube.png}} RightArm cube would be the following:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;RightArm&amp;quot;][&amp;quot;RightArm&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.RightArm.RightArm&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awesome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be indexed with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awesome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ParentTypes ==&lt;br /&gt;
In Figura, a [[ParentType]] is applied to a ModelPart causing the ModelPart to behave in a predefined way. This behavior includes acting as a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, or parrots, and binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a case-sensitive ParentType.&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType which can cause unintended behavior!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as [[ParentType/Hud|&amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules]]. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart properties ===&lt;br /&gt;
Read-only properties of a ModelPart&lt;br /&gt;
&lt;br /&gt;
==== getName ====&lt;br /&gt;
----&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getType ====&lt;br /&gt;
----&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their face data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Editing ModelPart hierarchy ===&lt;br /&gt;
Methods relating to getting other ModelParts and manipulating the ModelPart tree&lt;br /&gt;
&lt;br /&gt;
==== getParent ====&lt;br /&gt;
----&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|ModelPart|?}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getChildren ====&lt;br /&gt;
----&lt;br /&gt;
Returns an array containing all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart|[]}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
printTable(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== isChildOf ====&lt;br /&gt;
----&lt;br /&gt;
Recursively checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== copy ====&lt;br /&gt;
----&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setParentType|setParentType]],, [[#getParentType|getParentType]],&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children because it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#getName|getName]],, [[#getChildren|getChildren]],, [[#addChild|addChild]],, [[#removeChild|removeChild]],&lt;br /&gt;
&lt;br /&gt;
==== addChild ====&lt;br /&gt;
----&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#copy|copy]],, [[#setPos|setPos]],&lt;br /&gt;
&lt;br /&gt;
==== removeChild ====&lt;br /&gt;
----&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== remove ====&lt;br /&gt;
----&lt;br /&gt;
Removes this ModelPart from the parent&#039;s child list. Returns self&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;remove()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:remove() -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
models.model.root.LeftLeg:addChild(head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#addChild|addChild]],&lt;br /&gt;
&lt;br /&gt;
=== Manipulation ===&lt;br /&gt;
Methods relating to manipulating the ModelPart within physical space&lt;br /&gt;
&lt;br /&gt;
==== setPos ====&lt;br /&gt;
----&lt;br /&gt;
Sets the offset of the the position of the ModelPart. Position translation applies on the local rotation axis.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(pos {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Move 10 units on the local y axis&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getPos ====&lt;br /&gt;
----&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,10,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setPos|setPos]],&lt;br /&gt;
&lt;br /&gt;
==== setRot ====&lt;br /&gt;
----&lt;br /&gt;
Sets the rotation of the ModelPart. Rotates the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Rotate 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setRot(0, 45, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getRot ====&lt;br /&gt;
----&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;. Will be the Rotation values defined in BlockBench when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0) -- Most ModelParts will not have a rotation set in blockbench&lt;br /&gt;
head:setRot(45, 0, 0)&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setRot|setRot]],&lt;br /&gt;
&lt;br /&gt;
==== setScale ====&lt;br /&gt;
----&lt;br /&gt;
Sets the scale of the ModelPart. Scales the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Squishes and stretches the entire model&lt;br /&gt;
models.model:setScale(1.5, 0.75, 1.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getScale ====&lt;br /&gt;
----&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setScale|setScale]],&lt;br /&gt;
&lt;br /&gt;
==== setPivot ====&lt;br /&gt;
----&lt;br /&gt;
Sets the pivot point of the ModelPart. &#039;&#039;This overrides the pivot point defined in blockbench.&#039;&#039; It is recommended to use [[#setOffsetPivot|setOffsetPivot]], instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- For a normal size humanoid model, the Head&#039;s pivot point is usually at 0,24,0&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setPivot(0, 28, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getPivot ====&lt;br /&gt;
----&lt;br /&gt;
Returns the Pivot Point defined in BlockBench, or the value set by &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; if it was already overwritten.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- The Head group&#039;s pivot point for a humanoid model is usually at 0,24,0&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,24,0)&lt;br /&gt;
head:setPivot(0,0,0)&lt;br /&gt;
-- We have completely ruined the rendering of this ModelPart&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setPivot|setPivot]],&lt;br /&gt;
&lt;br /&gt;
==== setOffsetRot ====&lt;br /&gt;
----&lt;br /&gt;
Sets a rotation value that will be added to the ModelPart&#039;s rotation.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- ModelParts inherit their rotation from blockbench. The Head usually has a rotation of 0,0,0 for consistency with the vanilla model&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
-- Set the offset to 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setOffsetRot(0, 45, 0)&lt;br /&gt;
-- The original rotation is unchanged.&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&lt;br /&gt;
-- setOffsetRot is not additive.&lt;br /&gt;
head:setOffsetRot(0, 25, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,25,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#getRot|getRot]], [[#getOffsetRot|getOffsetRot]],&lt;br /&gt;
&lt;br /&gt;
==== getOffsetRot ====&lt;br /&gt;
----&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;. Will be 0,0,0 when the script begins&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetRot(45, 0, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOffsetRot|setOffsetRot]],&lt;br /&gt;
&lt;br /&gt;
==== setOffsetScale ====&lt;br /&gt;
----&lt;br /&gt;
Sets a scale value that will be multiplied with the ModelPart&#039;s scale.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Half the size of the head&lt;br /&gt;
head:setOffsetScale(0.5)&lt;br /&gt;
-- Results in no changes&lt;br /&gt;
-- I have no idea what this is used for&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getOffsetScale ====&lt;br /&gt;
----&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setOffsetScale(2)&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOffsetScale|setOffsetScale]],&lt;br /&gt;
&lt;br /&gt;
==== setOffsetPivot ====&lt;br /&gt;
----&lt;br /&gt;
Sets a value that will be added to the ModelPart&#039;s pivot point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube and offset the pivot up by 4,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setOffsetPivot(0, 4, 0)&lt;br /&gt;
-- Notice that we did not need to know the original pivot point to do this&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getOffsetPivot ====&lt;br /&gt;
----&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetPivot(0,4,0)&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,4,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOffsetPivot|setOffsetPivot]],&lt;br /&gt;
&lt;br /&gt;
==== setMatrix ====&lt;br /&gt;
----&lt;br /&gt;
Allows you to manually define the matrix used for positioning this ModelPart. Returns self for method chaining.&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt; will undo &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;getPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;getOffsetPivot&amp;lt;/code&amp;gt; will return invalid values while &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt; is in effect. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;getTruePos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueScale&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;getTruePivot&amp;lt;/code&amp;gt; are probably also affected, but nobody tested them yet.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setMatrix(matrix {{type|Matrix4}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTruePos ====&lt;br /&gt;
----&lt;br /&gt;
Returns the position after all calculations are done. This includes &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt; and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTrueRot ====&lt;br /&gt;
----&lt;br /&gt;
Returns the rotation after all calculations are done. This includes &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTrueScale ====&lt;br /&gt;
----&lt;br /&gt;
Returns the scale after all calculations are done. This includes &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTrueScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTruePivot ====&lt;br /&gt;
----&lt;br /&gt;
Returns the pivot point after all calculations are done. This includes &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visual manipulation ===&lt;br /&gt;
Methods relating to modifying how a ModelPart looks&lt;br /&gt;
&lt;br /&gt;
todo: put anything related to renderType, textures, and other visual modifications in here&lt;br /&gt;
&lt;br /&gt;
==== setVisible ====&lt;br /&gt;
----&lt;br /&gt;
Sets if this ModelPart is visible or not. Children of this ModelPart will also be invisible while this part is invisible.&lt;br /&gt;
&lt;br /&gt;
A value of &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; is interpreted as &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; on 0.1.4 and below, and &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; on 0.1.5 and above. This message will disappear &amp;lt;s&amp;gt;if&amp;lt;/s&amp;gt; when 0.1.6 is released.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setVisible(visible {{type|boolean}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
head:setVisible(false) -- Bye bye Head!&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getVisible ====&lt;br /&gt;
----&lt;br /&gt;
Recursively goes up the ModelPart tree until it finds a ModelPart that is invisible, or the ModelPart is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other words, if a parent part is invisible, this function returns &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;. If all parent parts are visible, this function will return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Kinda stupid. This is fixed in 0.1.5 to never return &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool|?}} {{until|0.1.5}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool}} {{since|0.1.5}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; nil --&amp;lt; this is stupid&lt;br /&gt;
root:setVisible(false) -- Bye bye root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; false&lt;br /&gt;
root:setVisible(true) -- Welcome back root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; true --&amp;lt; aaaaaaaa&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== setColor ====&lt;br /&gt;
----&lt;br /&gt;
Sets a value to multiply with all pixels on the ModelPart&#039;s texture. Children of this ModelPart inherit the color, multiplied with their own.&lt;br /&gt;
&lt;br /&gt;
1,1,1 multiplies all color channels by 1, resulting in the texture unchanged. 0,0,0 results in all channels being black.&lt;br /&gt;
&lt;br /&gt;
Expects values between 0 and 1. Numbers larger than 1 results in undocumented behaviour. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If only &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is defined as a number and both &amp;lt;code&amp;gt;g&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; are omitted, &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is used for all 3 color channels.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(color {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(colorAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(r {{type|number}}, g {{type|number}}, b {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Darken the entire model&lt;br /&gt;
root:setColor(0.5,0.5,0.5)&lt;br /&gt;
-- Tint the Head red by reducing the other color channels.&lt;br /&gt;
-- Color is inherited from parents, so the effective color is (0.5, 0.45, 0.45)&lt;br /&gt;
root.Head:setColor(1,0.7,0.7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- If you want to &#039;reset&#039; a child&#039;s color value, extra work is needed.&lt;br /&gt;
&lt;br /&gt;
-- Color is max red&lt;br /&gt;
local color = vec(1,0,0)&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- root has color&lt;br /&gt;
root:setColor(color)&lt;br /&gt;
-- Through magic and wizardry, this &#039;resets&#039; the color of Head back to white, dispite it&#039;s parent having a non-white color&lt;br /&gt;
root.Head:setColor(-color + 2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getColor ====&lt;br /&gt;
----&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setColor&amp;lt;/code&amp;gt;. Returns 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getColor()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
root:setColor(0.5)&lt;br /&gt;
print(root:getColor()) --&amp;gt; (0.5, 0.5, 0.5)&lt;br /&gt;
root.Head:setColor(1,0.7,0.7)&lt;br /&gt;
// getColor is not recursive&lt;br /&gt;
print(root.Head:getColor()) --&amp;gt; (1, 0.7, 0.7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setColor|setColor]],&lt;br /&gt;
&lt;br /&gt;
==== setOpacity ====&lt;br /&gt;
----&lt;br /&gt;
Sets the opacity of the ModelPart. Children of this ModelPart inherit the opacity, multiplied with their own.&lt;br /&gt;
&lt;br /&gt;
Minecraft has a minimum visible opacity of 0.1. Opacity values lower than 0.1 will not render at all. Needs verification.&lt;br /&gt;
&lt;br /&gt;
Only supported on [[RenderType|RenderTypes]] that support translucency. The default primary RenderType is &amp;lt;code&amp;gt;TRANSLUCENT&amp;lt;/code&amp;gt;, so most don&#039;t have to worry about it.&lt;br /&gt;
&lt;br /&gt;
Expects a value between 0 and 1.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOpacity(opacity {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Half opacity&lt;br /&gt;
root:setOpacity(0.5)&lt;br /&gt;
-- Half of half opacity&lt;br /&gt;
root.Head:setColor(0.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getOpacity ====&lt;br /&gt;
----&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setOpacity&amp;lt;/code&amp;gt;. Returns 1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOpacity()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|number}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
root:setOpacity(0.5)&lt;br /&gt;
print(root:getOpacity()) --&amp;gt; 0.5&lt;br /&gt;
root.Head:setOpacity(0.5)&lt;br /&gt;
// getOpacity is not recursive&lt;br /&gt;
print(root.Head:getOpacity()) --&amp;gt; 0.5&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOpacity|setOpacity]],&lt;br /&gt;
&lt;br /&gt;
==== setLight ====&lt;br /&gt;
----&lt;br /&gt;
Overrides the lightlevels used to render the ModelPart. Children of this ModelPart inherit the lightlevel.&lt;br /&gt;
&lt;br /&gt;
Expects 2 values between 0 and 15, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Providing &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; will undo the override, allowing Minecraft to control the lightlevel again.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setLight(light {{type|Vector2|?}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setLight(blockLight {{type|integer|?}}, skyLight {{type|integer|?}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Max light&lt;br /&gt;
root:setLight(15, 15)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- set light based on position (This is a fix for broken lighting on World parts)&lt;br /&gt;
function events.tick()&lt;br /&gt;
  local pos = player:getPos()&lt;br /&gt;
  local blockLight = world.getBlockLightLevel(pos)&lt;br /&gt;
  local skyLight = world.getSkyLightLevel(pos)&lt;br /&gt;
  root:setLight(blockLight, skyLight)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[PlayerAPI#PlayerAPI:getPos|player:getPos]] [[WorldAPI#WorldAPI.getBlockLightLevel|world.getBlockLightLevel]] [[WorldAPI#WorldAPI.getSkyLightLevel|world.getSkyLightLevel]]&lt;br /&gt;
&lt;br /&gt;
==== getLight ====&lt;br /&gt;
----&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setLight&amp;lt;/code&amp;gt;. Returns &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getLight()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector2}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
&lt;br /&gt;
print(root:getLight()) --&amp;gt; nil&lt;br /&gt;
&lt;br /&gt;
root:setLight(12, 8)&lt;br /&gt;
&lt;br /&gt;
let light = root:getLight()&lt;br /&gt;
print(light) --&amp;gt; vec(12, 8)&lt;br /&gt;
print(&amp;quot;BlockLightLevel -&amp;gt; &amp;quot;, light.x) --&amp;gt; &amp;quot;BlockLightLevel -&amp;gt; 12&amp;quot;&lt;br /&gt;
print(&amp;quot;SkyLightLevel -&amp;gt; &amp;quot;, light.y) --&amp;gt; &amp;quot;BlockLightLevel -&amp;gt; 8&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setLight|setLight]],&lt;br /&gt;
&lt;br /&gt;
==== setOverlay ====&lt;br /&gt;
----&lt;br /&gt;
Overrides the values used for rendering the red damage tint and the white creeper fuse effect. Really only useful for preventing the damage overlay from rendering on stuff like armor.&lt;br /&gt;
&lt;br /&gt;
Valid values for whiteOverlay: 0-15&lt;br /&gt;
&lt;br /&gt;
Valid values for hurtOverlay: 0-7&lt;br /&gt;
&lt;br /&gt;
whiteOverlay is a gradually increasing white tint from 0 - 15&lt;br /&gt;
&lt;br /&gt;
hurtOverlay is an unchanging red tint from 0 - 7.&lt;br /&gt;
&lt;br /&gt;
When set, hurtOverlay overrides whiteOverlay. For whiteOverlay to not be overriden, hurtOverlay needs to be 8 or more.&lt;br /&gt;
&lt;br /&gt;
Providing &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; will undo the override, allowing Minecraft to control the overlay again.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOverlay(overlayVector {{type|Vector2|?}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOverlay(whiteOverlay {{type|integer|?}}, hurtOverlay {{type|integer}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Damage overlay&lt;br /&gt;
root:setOverlay(0, 0)&lt;br /&gt;
-- Literally no difference&lt;br /&gt;
root:setOverlay(0, 5)&lt;br /&gt;
root:setOverlay(0, 7)&lt;br /&gt;
&lt;br /&gt;
-- Doesnt work. Damage overlay overrides white&lt;br /&gt;
root:setOverlay(15, 0)&lt;br /&gt;
&lt;br /&gt;
-- This works. Max white overlay&lt;br /&gt;
root:setOverlay(15, 15)&lt;br /&gt;
&lt;br /&gt;
-- This can be used to for preventing the damage overlay on armor&lt;br /&gt;
root:setOverlay(0, 15)&lt;br /&gt;
&lt;br /&gt;
-- Give control back to Minecraft&lt;br /&gt;
root:setOverlay(nil)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getOverlay ====&lt;br /&gt;
----&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setOverlay&amp;lt;/code&amp;gt;. Returns &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOverlay()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector2}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
&lt;br /&gt;
print(root:getOverlay()) --&amp;gt; nil&lt;br /&gt;
&lt;br /&gt;
root:setOverlay(8, 15)&lt;br /&gt;
&lt;br /&gt;
let overlay = root:getOverlay()&lt;br /&gt;
print(overlay) --&amp;gt; vec(8, 15)&lt;br /&gt;
print(&amp;quot;whiteOverlay -&amp;gt; &amp;quot;, overlay.x) --&amp;gt; &amp;quot;whiteOverlay -&amp;gt; 8&amp;quot;&lt;br /&gt;
print(&amp;quot;hurtOverlay -&amp;gt; &amp;quot;, overlay.y) --&amp;gt; &amp;quot;hurtOverlay -&amp;gt; 15&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOverlay|setOverlay]],&lt;br /&gt;
&lt;br /&gt;
=== renderTasks ===&lt;br /&gt;
todo: put all rendertask functions in here &lt;br /&gt;
&lt;br /&gt;
=== Render methods ===&lt;br /&gt;
todo: Put partToWorldMatrix, preRender, midRender, and PostRender in here&lt;br /&gt;
&lt;br /&gt;
=== Animation methods ===&lt;br /&gt;
todo: put getAnimPos/Rot/Scale and overrideVanillaPos/Rot/Scale in here&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
{{Navbox documentation}}&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=360</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=360"/>
		<updated>2024-09-28T20:16:06Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: /* ParentTypes via BlockBench */ link to hud specifications/tutorial page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into a ModelPart.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
{{note|&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; itself is a ModelPart. This allows you to apply transformations to the entire model, using e.g. &amp;lt;code&amp;gt;models:setScale(0.5)&amp;lt;/code&amp;gt;.|tag=Trivia|color=#A155DA}}&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be indexed with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ParentTypes ==&lt;br /&gt;
In Figura, a [[ParentType]] is applied to a ModelPart causing the ModelPart to behave in a predefined way. This behavior includes acting as a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, or parrots, and binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a case-sensitive ParentType.&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType which can cause unintended behavior!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as [[ParentType/Hud|&amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules]]. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart Properties ===&lt;br /&gt;
Read-only properties of a ModelPart&lt;br /&gt;
&lt;br /&gt;
==== getName ====&lt;br /&gt;
----&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getType ====&lt;br /&gt;
----&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their face data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Editing ModelPart Hierarchy ===&lt;br /&gt;
Methods relating to getting other ModelParts and manipulating the ModelPart tree&lt;br /&gt;
&lt;br /&gt;
==== getParent ====&lt;br /&gt;
----&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|ModelPart|?}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getChildren ====&lt;br /&gt;
----&lt;br /&gt;
Returns an array containing all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart|[]}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
printTable(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== isChildOf ====&lt;br /&gt;
----&lt;br /&gt;
Recursively checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== copy ====&lt;br /&gt;
----&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setParentType|setParentType]],, [[#getParentType|getParentType]],&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children because it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#getName|getName]],, [[#getChildren|getChildren]],, [[#addChild|addChild]],, [[#removeChild|removeChild]],&lt;br /&gt;
&lt;br /&gt;
==== addChild ====&lt;br /&gt;
----&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#copy|copy]],, [[#setPos|setPos]],&lt;br /&gt;
&lt;br /&gt;
==== removeChild ====&lt;br /&gt;
----&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== remove ====&lt;br /&gt;
----&lt;br /&gt;
Removes this ModelPart from the parent&#039;s child list. Returns self&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;remove()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:remove() -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
models.model.root.LeftLeg:addChild(head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#addChild|addChild]],&lt;br /&gt;
&lt;br /&gt;
=== Manipulation ===&lt;br /&gt;
Methods relating to manipulating the ModelPart within physical space&lt;br /&gt;
&lt;br /&gt;
==== setPos ====&lt;br /&gt;
----&lt;br /&gt;
Sets the offset of the the position of the ModelPart. Position translation applies on the local rotation axis.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(pos {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Move 10 units on the local y axis&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getPos ====&lt;br /&gt;
----&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,10,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setPos|setPos]],&lt;br /&gt;
&lt;br /&gt;
==== setRot ====&lt;br /&gt;
----&lt;br /&gt;
Sets the rotation of the ModelPart. Rotates the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Rotate 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setRot(0, 45, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getRot ====&lt;br /&gt;
----&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;. Will be the Rotation values defined in BlockBench when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0) -- Most ModelParts will not have a rotation set in blockbench&lt;br /&gt;
head:setRot(45, 0, 0)&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setRot|setRot]],&lt;br /&gt;
&lt;br /&gt;
==== setScale ====&lt;br /&gt;
----&lt;br /&gt;
Sets the scale of the ModelPart. Scales the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Squishes and stretches the entire model&lt;br /&gt;
models.model:setScale(1.5, 0.75, 1.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getScale ====&lt;br /&gt;
----&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setScale|setScale]],&lt;br /&gt;
&lt;br /&gt;
==== setPivot ====&lt;br /&gt;
----&lt;br /&gt;
Sets the pivot point of the ModelPart. &#039;&#039;This overrides the pivot point defined in blockbench.&#039;&#039; It is recommended to use [[#setOffsetPivot|setOffsetPivot]], instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- For a normal size humanoid model, the Head&#039;s pivot point is usually at 0,24,0&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setPivot(0, 28, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getPivot ====&lt;br /&gt;
----&lt;br /&gt;
Returns the Pivot Point defined in BlockBench, or the value set by &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; if it was already overwritten.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- The Head group&#039;s pivot point for a humanoid model is usually at 0,24,0&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,24,0)&lt;br /&gt;
head:setPivot(0,0,0)&lt;br /&gt;
-- We have completely ruined the rendering of this ModelPart&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setPivot|setPivot]],&lt;br /&gt;
&lt;br /&gt;
==== setOffsetRot ====&lt;br /&gt;
----&lt;br /&gt;
Sets a rotation value that will be added to the ModelPart&#039;s rotation.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- ModelParts inherit their rotation from blockbench. The Head usually has a rotation of 0,0,0 for consistency with the vanilla model&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
-- Set the offset to 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setOffsetRot(0, 45, 0)&lt;br /&gt;
-- The original rotation is unchanged.&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&lt;br /&gt;
-- setOffsetRot is not additive.&lt;br /&gt;
head:setOffsetRot(0, 25, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,25,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#getRot|getRot]], [[#getOffsetRot|getOffsetRot]],&lt;br /&gt;
&lt;br /&gt;
==== getOffsetRot ====&lt;br /&gt;
----&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;. Will be 0,0,0 when the script begins&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetRot(45, 0, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOffsetRot|setOffsetRot]],&lt;br /&gt;
&lt;br /&gt;
==== setOffsetScale ====&lt;br /&gt;
----&lt;br /&gt;
Sets a scale value that will be multiplied with the ModelPart&#039;s scale.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Half the size of the head&lt;br /&gt;
head:setOffsetScale(0.5)&lt;br /&gt;
-- Results in no changes&lt;br /&gt;
-- I have no idea what this is used for&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getOffsetScale ====&lt;br /&gt;
----&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setOffsetScale(2)&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOffsetScale|setOffsetScale]],&lt;br /&gt;
&lt;br /&gt;
==== setOffsetPivot ====&lt;br /&gt;
----&lt;br /&gt;
Sets a value that will be added to the ModelPart&#039;s pivot point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube and offset the pivot up by 4,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setOffsetPivot(0, 4, 0)&lt;br /&gt;
-- Notice that we did not need to know the original pivot point to do this&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getOffsetPivot ====&lt;br /&gt;
----&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetPivot(0,4,0)&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,4,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOffsetPivot|setOffsetPivot]],&lt;br /&gt;
&lt;br /&gt;
==== setMatrix ====&lt;br /&gt;
----&lt;br /&gt;
Allows you to manually define the matrix used for positioning this ModelPart. Returns self for method chaining.&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt; will undo &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;getPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;getOffsetPivot&amp;lt;/code&amp;gt; will return invalid values while &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt; is in effect. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;getTruePos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueScale&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;getTruePivot&amp;lt;/code&amp;gt; are probably also affected, but nobody tested them yet.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setMatrix(matrix {{type|Matrix4}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTruePos ====&lt;br /&gt;
----&lt;br /&gt;
Returns the position after all calculations are done. This includes &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt; and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTrueRot ====&lt;br /&gt;
----&lt;br /&gt;
Returns the rotation after all calculations are done. This includes &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTrueScale ====&lt;br /&gt;
----&lt;br /&gt;
Returns the scale after all calculations are done. This includes &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTrueScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTruePivot ====&lt;br /&gt;
----&lt;br /&gt;
Returns the pivot point after all calculations are done. This includes &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visual Manipulation ===&lt;br /&gt;
Methods relating to modifying how a ModelPart looks&lt;br /&gt;
&lt;br /&gt;
todo: put anything related to renderType, textures, and other visual modifications in here&lt;br /&gt;
&lt;br /&gt;
==== setVisible ====&lt;br /&gt;
----&lt;br /&gt;
Sets if this ModelPart is visible or not. Children of this ModelPart will also be invisible while this part is invisible.&lt;br /&gt;
&lt;br /&gt;
A value of &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; is interpreted as &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; on 0.1.4 and below, and &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; on 0.1.5 and above. This message will disappear &amp;lt;s&amp;gt;if&amp;lt;/s&amp;gt; when 0.1.6 is released.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setVisible(visible {{type|boolean}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
head:setVisible(false) -- Bye bye Head!&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getVisible ====&lt;br /&gt;
----&lt;br /&gt;
Recursively goes up the ModelPart tree until it finds a ModelPart that is invisible, or the ModelPart is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other words, if a parent part is invisible, this function returns &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;. If all parent parts are visible, this function will return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Kinda stupid. This is fixed in 0.1.5 to never return &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool|?}} {{until|0.1.5}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool}} {{since|0.1.5}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; nil --&amp;lt; this is stupid&lt;br /&gt;
root:setVisible(false) -- Bye bye root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; false&lt;br /&gt;
root:setVisible(true) -- Welcome back root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; true --&amp;lt; aaaaaaaa&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== setColor ====&lt;br /&gt;
----&lt;br /&gt;
Sets a value to multiply with all pixels on the ModelPart&#039;s texture. Children of this ModelPart inherit the color, multiplied with their own.&lt;br /&gt;
&lt;br /&gt;
1,1,1 multiplies all color channels by 1, resulting in the texture unchanged. 0,0,0 results in all channels being black.&lt;br /&gt;
&lt;br /&gt;
Expects values between 0 and 1. Numbers larger than 1 results in undocumented behaviour. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If only &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is defined as a number and both &amp;lt;code&amp;gt;g&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; are omitted, &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is used for all 3 color channels.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(color {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(colorAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(r {{type|number}}, g {{type|number}}, b {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Darken the entire model&lt;br /&gt;
root:setColor(0.5,0.5,0.5)&lt;br /&gt;
-- Tint the Head red by reducing the other color channels.&lt;br /&gt;
-- Color is inherited from parents, so the effective color is (0.5, 0.45, 0.45)&lt;br /&gt;
root.Head:setColor(1,0.7,0.7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- If you want to &#039;reset&#039; a child&#039;s color value, extra work is needed.&lt;br /&gt;
&lt;br /&gt;
-- Color is max red&lt;br /&gt;
local color = vec(1,0,0)&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- root has color&lt;br /&gt;
root:setColor(color)&lt;br /&gt;
-- Through magic and wizardry, this &#039;resets&#039; the color of Head back to white, dispite it&#039;s parent having a non-white color&lt;br /&gt;
root.Head:setColor(-color + 2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getColor ====&lt;br /&gt;
----&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setColor&amp;lt;/code&amp;gt;. Returns 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getColor()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
root:setColor(0.5)&lt;br /&gt;
print(root:getColor()) --&amp;gt; (0.5, 0.5, 0.5)&lt;br /&gt;
root.Head:setColor(1,0.7,0.7)&lt;br /&gt;
// getColor is not recursive&lt;br /&gt;
print(root.Head:getColor()) --&amp;gt; (1, 0.7, 0.7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setColor|setColor]],&lt;br /&gt;
&lt;br /&gt;
==== setOpacity ====&lt;br /&gt;
----&lt;br /&gt;
Sets the opacity of the ModelPart. Children of this ModelPart inherit the opacity, multiplied with their own.&lt;br /&gt;
&lt;br /&gt;
Minecraft has a minimum visible opacity of 0.1. Opacity values lower than 0.1 will not render at all. Needs verification.&lt;br /&gt;
&lt;br /&gt;
Only supported on [[RenderType|RenderTypes]] that support translucency. The default primary RenderType is &amp;lt;code&amp;gt;TRANSLUCENT&amp;lt;/code&amp;gt;, so most don&#039;t have to worry about it.&lt;br /&gt;
&lt;br /&gt;
Expects a value between 0 and 1.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOpacity(opacity {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Half opacity&lt;br /&gt;
root:setOpacity(0.5)&lt;br /&gt;
-- Half of half opacity&lt;br /&gt;
root.Head:setColor(0.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getOpacity ====&lt;br /&gt;
----&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setOpacity&amp;lt;/code&amp;gt;. Returns 1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOpacity()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|number}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
root:setOpacity(0.5)&lt;br /&gt;
print(root:getOpacity()) --&amp;gt; 0.5&lt;br /&gt;
root.Head:setOpacity(0.5)&lt;br /&gt;
// getOpacity is not recursive&lt;br /&gt;
print(root.Head:getOpacity()) --&amp;gt; 0.5&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOpacity|setOpacity]],&lt;br /&gt;
&lt;br /&gt;
==== setLight ====&lt;br /&gt;
----&lt;br /&gt;
Overrides the lightlevels used to render the ModelPart. Children of this ModelPart inherit the lightlevel.&lt;br /&gt;
&lt;br /&gt;
Expects 2 values between 0 and 15, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Providing &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; will undo the override, allowing Minecraft to control the lightlevel again.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setLight(light {{type|Vector2|?}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setLight(blockLight {{type|integer|?}}, skyLight {{type|integer|?}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Max light&lt;br /&gt;
root:setLight(15, 15)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- set light based on position (This is a fix for broken lighting on World parts)&lt;br /&gt;
function events.tick()&lt;br /&gt;
  local pos = player:getPos()&lt;br /&gt;
  local blockLight = world.getBlockLightLevel(pos)&lt;br /&gt;
  local skyLight = world.getSkyLightLevel(pos)&lt;br /&gt;
  root:setLight(blockLight, skyLight)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[PlayerAPI#PlayerAPI:getPos|player:getPos]] [[WorldAPI#WorldAPI.getBlockLightLevel|world.getBlockLightLevel]] [[WorldAPI#WorldAPI.getSkyLightLevel|world.getSkyLightLevel]]&lt;br /&gt;
&lt;br /&gt;
==== getLight ====&lt;br /&gt;
----&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setLight&amp;lt;/code&amp;gt;. Returns &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getLight()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector2}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
&lt;br /&gt;
print(root:getLight()) --&amp;gt; nil&lt;br /&gt;
&lt;br /&gt;
root:setLight(12, 8)&lt;br /&gt;
&lt;br /&gt;
let light = root:getLight()&lt;br /&gt;
print(light) --&amp;gt; vec(12, 8)&lt;br /&gt;
print(&amp;quot;BlockLightLevel -&amp;gt; &amp;quot;, light.x) --&amp;gt; &amp;quot;BlockLightLevel -&amp;gt; 12&amp;quot;&lt;br /&gt;
print(&amp;quot;SkyLightLevel -&amp;gt; &amp;quot;, light.y) --&amp;gt; &amp;quot;BlockLightLevel -&amp;gt; 8&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setLight|setLight]],&lt;br /&gt;
&lt;br /&gt;
==== setOverlay ====&lt;br /&gt;
----&lt;br /&gt;
Overrides the values used for rendering the red damage tint and the white creeper fuse effect. Really only useful for preventing the damage overlay from rendering on stuff like armor.&lt;br /&gt;
&lt;br /&gt;
Valid values for whiteOverlay: 0-15&lt;br /&gt;
&lt;br /&gt;
Valid values for hurtOverlay: 0-7&lt;br /&gt;
&lt;br /&gt;
whiteOverlay is a gradually increasing white tint from 0 - 15&lt;br /&gt;
&lt;br /&gt;
hurtOverlay is an unchanging red tint from 0 - 7.&lt;br /&gt;
&lt;br /&gt;
When set, hurtOverlay overrides whiteOverlay. For whiteOverlay to not be overriden, hurtOverlay needs to be 8 or more.&lt;br /&gt;
&lt;br /&gt;
Providing &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; will undo the override, allowing Minecraft to control the overlay again.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOverlay(overlayVector {{type|Vector2|?}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOverlay(whiteOverlay {{type|integer|?}}, hurtOverlay {{type|integer}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Damage overlay&lt;br /&gt;
root:setOverlay(0, 0)&lt;br /&gt;
-- Literally no difference&lt;br /&gt;
root:setOverlay(0, 5)&lt;br /&gt;
root:setOverlay(0, 7)&lt;br /&gt;
&lt;br /&gt;
-- Doesnt work. Damage overlay overrides white&lt;br /&gt;
root:setOverlay(15, 0)&lt;br /&gt;
&lt;br /&gt;
-- This works. Max white overlay&lt;br /&gt;
root:setOverlay(15, 15)&lt;br /&gt;
&lt;br /&gt;
-- This can be used to for preventing the damage overlay on armor&lt;br /&gt;
root:setOverlay(0, 15)&lt;br /&gt;
&lt;br /&gt;
-- Give control back to Minecraft&lt;br /&gt;
root:setOverlay(nil)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getOverlay ====&lt;br /&gt;
----&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setOverlay&amp;lt;/code&amp;gt;. Returns &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOverlay()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector2}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
&lt;br /&gt;
print(root:getOverlay()) --&amp;gt; nil&lt;br /&gt;
&lt;br /&gt;
root:setOverlay(8, 15)&lt;br /&gt;
&lt;br /&gt;
let overlay = root:getOverlay()&lt;br /&gt;
print(overlay) --&amp;gt; vec(8, 15)&lt;br /&gt;
print(&amp;quot;whiteOverlay -&amp;gt; &amp;quot;, overlay.x) --&amp;gt; &amp;quot;whiteOverlay -&amp;gt; 8&amp;quot;&lt;br /&gt;
print(&amp;quot;hurtOverlay -&amp;gt; &amp;quot;, overlay.y) --&amp;gt; &amp;quot;hurtOverlay -&amp;gt; 15&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOverlay|setOverlay]],&lt;br /&gt;
&lt;br /&gt;
=== renderTasks ===&lt;br /&gt;
todo: put all rendertask functions in here &lt;br /&gt;
&lt;br /&gt;
=== Render Methods ===&lt;br /&gt;
todo: Put partToWorldMatrix, preRender, midRender, and PostRender in here&lt;br /&gt;
&lt;br /&gt;
=== Animation Methods ===&lt;br /&gt;
todo: put getAnimPos/Rot/Scale and overrideVanillaPos/Rot/Scale in here&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=Models&amp;diff=322</id>
		<title>Models</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=Models&amp;diff=322"/>
		<updated>2024-09-28T16:28:16Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: Changed redirect target from ModelParts to ModelPart&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[ModelPart]]&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=320</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=320"/>
		<updated>2024-09-28T16:18:43Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: /* Visual Manipulation */ regex fail lmao&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into a ModelPart.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
{{note|&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; itself is a ModelPart. This allows you to apply transformations to the entire model, using e.g. &amp;lt;code&amp;gt;models:setScale(0.5)&amp;lt;/code&amp;gt;.|tag=Trivia|color=#A155DA}}&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be indexed with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ParentTypes ==&lt;br /&gt;
In Figura, a [[ParentType]] is applied to a ModelPart causing the ModelPart to behave in a predefined way. This behavior includes acting as a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, or parrots, and binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a case-sensitive ParentType.&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType which can cause unintended behavior!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart Properties ===&lt;br /&gt;
Read-only properties of a ModelPart&lt;br /&gt;
&lt;br /&gt;
==== getName ====&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getType ====&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their face data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Editing ModelPart Hierarchy ===&lt;br /&gt;
Methods relating to getting other ModelParts and manipulating the ModelPart tree&lt;br /&gt;
&lt;br /&gt;
==== getParent ====&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|ModelPart|?}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getChildren ====&lt;br /&gt;
Returns an array containing all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart|[]}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
printTable(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== isChildOf ====&lt;br /&gt;
Recursively checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== copy ====&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setParentType|setParentType]],, [[#getParentType|getParentType]],&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children because it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#getName|getName]],, [[#getChildren|getChildren]],, [[#addChild|addChild]],, [[#removeChild|removeChild]],&lt;br /&gt;
&lt;br /&gt;
==== addChild ====&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#copy|copy]],, [[#setPos|setPos]],&lt;br /&gt;
&lt;br /&gt;
==== removeChild ====&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== remove ====&lt;br /&gt;
Removes this ModelPart from the parent&#039;s child list. Returns self&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;remove()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:remove() -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
models.model.root.LeftLeg:addChild(head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#addChild|addChild]],&lt;br /&gt;
&lt;br /&gt;
=== Manipulation ===&lt;br /&gt;
Methods relating to manipulating the ModelPart within physical space&lt;br /&gt;
&lt;br /&gt;
==== setPos ====&lt;br /&gt;
Sets the offset of the the position of the ModelPart. Position translation applies on the local rotation axis.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(pos {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Move 10 units on the local y axis&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getPos ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,10,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setPos|setPos]],&lt;br /&gt;
&lt;br /&gt;
==== setRot ====&lt;br /&gt;
Sets the rotation of the ModelPart. Rotates the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Rotate 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setRot(0, 45, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getRot ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;. Will be the Rotation values defined in BlockBench when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0) -- Most ModelParts will not have a rotation set in blockbench&lt;br /&gt;
head:setRot(45, 0, 0)&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setRot|setRot]],&lt;br /&gt;
&lt;br /&gt;
==== setScale ====&lt;br /&gt;
Sets the scale of the ModelPart. Scales the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Squishes and stretches the entire model&lt;br /&gt;
models.model:setScale(1.5, 0.75, 1.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getScale ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setScale|setScale]],&lt;br /&gt;
&lt;br /&gt;
==== setPivot ====&lt;br /&gt;
Sets the pivot point of the ModelPart. &#039;&#039;This overrides the pivot point defined in blockbench.&#039;&#039; It is recommended to use [[#setOffsetPivot|setOffsetPivot]], instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- For a normal size humanoid model, the Head&#039;s pivot point is usually at 0,24,0&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setPivot(0, 28, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getPivot ====&lt;br /&gt;
Returns the Pivot Point defined in BlockBench, or the value set by &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; if it was already overwritten.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- The Head group&#039;s pivot point for a humanoid model is usually at 0,24,0&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,24,0)&lt;br /&gt;
head:setPivot(0,0,0)&lt;br /&gt;
-- We have completely ruined the rendering of this ModelPart&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setPivot|setPivot]],&lt;br /&gt;
&lt;br /&gt;
==== setOffsetRot ====&lt;br /&gt;
Sets a rotation value that will be added to the ModelPart&#039;s rotation.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- ModelParts inherit their rotation from blockbench. The Head usually has a rotation of 0,0,0 for consistency with the vanilla model&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
-- Set the offset to 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setOffsetRot(0, 45, 0)&lt;br /&gt;
-- The original rotation is unchanged.&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&lt;br /&gt;
-- setOffsetRot is not additive.&lt;br /&gt;
head:setOffsetRot(0, 25, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,25,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#getRot|getRot]], [[#getOffsetRot|getOffsetRot]],&lt;br /&gt;
&lt;br /&gt;
==== getOffsetRot ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;. Will be 0,0,0 when the script begins&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetRot(45, 0, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOffsetRot|setOffsetRot]],&lt;br /&gt;
&lt;br /&gt;
==== setOffsetScale ====&lt;br /&gt;
Sets a scale value that will be multiplied with the ModelPart&#039;s scale.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Half the size of the head&lt;br /&gt;
head:setOffsetScale(0.5)&lt;br /&gt;
-- Results in no changes&lt;br /&gt;
-- I have no idea what this is used for&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getOffsetScale ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setOffsetScale(2)&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOffsetScale|setOffsetScale]],&lt;br /&gt;
&lt;br /&gt;
==== setOffsetPivot ====&lt;br /&gt;
Sets a value that will be added to the ModelPart&#039;s pivot point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube and offset the pivot up by 4,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setOffsetPivot(0, 4, 0)&lt;br /&gt;
-- Notice that we did not need to know the original pivot point to do this&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getOffsetPivot ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetPivot(0,4,0)&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,4,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOffsetPivot|setOffsetPivot]],&lt;br /&gt;
&lt;br /&gt;
==== setMatrix ====&lt;br /&gt;
Allows you to manually define the matrix used for positioning this ModelPart. Returns self for method chaining.&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt; will undo &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;getPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;getOffsetPivot&amp;lt;/code&amp;gt; will return invalid values while &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt; is in effect. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;getTruePos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueScale&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;getTruePivot&amp;lt;/code&amp;gt; are probably also affected, but nobody tested them yet.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setMatrix(matrix {{type|Matrix4}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTruePos ====&lt;br /&gt;
Returns the position after all calculations are done. This includes &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt; and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTrueRot ====&lt;br /&gt;
Returns the rotation after all calculations are done. This includes &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTrueScale ====&lt;br /&gt;
Returns the scale after all calculations are done. This includes &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTrueScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTruePivot ====&lt;br /&gt;
Returns the pivot point after all calculations are done. This includes &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visual Manipulation ===&lt;br /&gt;
Methods relating to modifying how a ModelPart looks&lt;br /&gt;
&lt;br /&gt;
todo: put anything related to renderType, textures, and other visual modifications in here&lt;br /&gt;
&lt;br /&gt;
==== setVisible ====&lt;br /&gt;
Sets if this ModelPart is visible or not. Children of this ModelPart will also be invisible while this part is invisible.&lt;br /&gt;
&lt;br /&gt;
A value of &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; is interpreted as &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; on 0.1.4 and below, and &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; on 0.1.5 and above. This message will disappear &amp;lt;s&amp;gt;if&amp;lt;/s&amp;gt; when 0.1.6 is released.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setVisible(visible {{type|boolean}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
head:setVisible(false) -- Bye bye Head!&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getVisible ====&lt;br /&gt;
Recursively goes up the ModelPart tree until it finds a ModelPart that is invisible, or the ModelPart is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other words, if a parent part is invisible, this function returns &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;. If all parent parts are visible, this function will return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Kinda stupid. This is fixed in 0.1.5 to never return &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool|?}} {{until|0.1.5}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool}} {{since|0.1.5}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; nil --&amp;lt; this is stupid&lt;br /&gt;
root:setVisible(false) -- Bye bye root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; false&lt;br /&gt;
root:setVisible(true) -- Welcome back root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; true --&amp;lt; aaaaaaaa&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== setColor ====&lt;br /&gt;
Sets a value to multiply with all pixels on the ModelPart&#039;s texture. Children of this ModelPart inherit the color, multiplied with their own.&lt;br /&gt;
&lt;br /&gt;
1,1,1 multiplies all color channels by 1, resulting in the texture unchanged. 0,0,0 results in all channels being black.&lt;br /&gt;
&lt;br /&gt;
Expects values between 0 and 1. Numbers larger than 1 results in undocumented behaviour. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If only &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is defined as a number and both &amp;lt;code&amp;gt;g&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; are omitted, &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is used for all 3 color channels.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(color {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(colorAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(r {{type|number}}, g {{type|number}}, b {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Darken the entire model&lt;br /&gt;
root:setColor(0.5,0.5,0.5)&lt;br /&gt;
-- Tint the Head red by reducing the other color channels.&lt;br /&gt;
-- Color is inherited from parents, so the effective color is (0.5, 0.45, 0.45)&lt;br /&gt;
root.Head:setColor(1,0.7,0.7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- If you want to &#039;reset&#039; a child&#039;s color value, extra work is needed.&lt;br /&gt;
&lt;br /&gt;
-- Color is max red&lt;br /&gt;
local color = vec(1,0,0)&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- root has color&lt;br /&gt;
root:setColor(color)&lt;br /&gt;
-- Through magic and wizardry, this &#039;resets&#039; the color of Head back to white, dispite it&#039;s parent having a non-white color&lt;br /&gt;
root.Head:setColor(-color + 2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getColor ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setColor&amp;lt;/code&amp;gt;. Returns 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getColor()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
root:setColor(0.5)&lt;br /&gt;
print(root:getColor()) --&amp;gt; (0.5, 0.5, 0.5)&lt;br /&gt;
root.Head:setColor(1,0.7,0.7)&lt;br /&gt;
// getColor is not recursive&lt;br /&gt;
print(root.Head:getColor()) --&amp;gt; (1, 0.7, 0.7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setColor|setColor]],&lt;br /&gt;
&lt;br /&gt;
==== setOpacity ====&lt;br /&gt;
Sets the opacity of the ModelPart. Children of this ModelPart inherit the opacity, multiplied with their own.&lt;br /&gt;
&lt;br /&gt;
Minecraft has a minimum visible opacity of 0.1. Opacity values lower than 0.1 will not render at all. Needs verification.&lt;br /&gt;
&lt;br /&gt;
Only supported on [[RenderType|RenderTypes]] that support translucency. The default primary RenderType is &amp;lt;code&amp;gt;TRANSLUCENT&amp;lt;/code&amp;gt;, so most don&#039;t have to worry about it.&lt;br /&gt;
&lt;br /&gt;
Expects a value between 0 and 1.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOpacity(opacity {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Half opacity&lt;br /&gt;
root:setOpacity(0.5)&lt;br /&gt;
-- Half of half opacity&lt;br /&gt;
root.Head:setColor(0.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getOpacity ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setOpacity&amp;lt;/code&amp;gt;. Returns 1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOpacity()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|number}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
root:setOpacity(0.5)&lt;br /&gt;
print(root:getOpacity()) --&amp;gt; 0.5&lt;br /&gt;
root.Head:setOpacity(0.5)&lt;br /&gt;
// getOpacity is not recursive&lt;br /&gt;
print(root.Head:getOpacity()) --&amp;gt; 0.5&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOpacity|setOpacity]],&lt;br /&gt;
&lt;br /&gt;
==== setLight ====&lt;br /&gt;
Overrides the lightlevels used to render the ModelPart. Children of this ModelPart inherit the lightlevel.&lt;br /&gt;
&lt;br /&gt;
Expects 2 values between 0 and 15, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Providing &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; will undo the override, allowing Minecraft to control the lightlevel again.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setLight(light {{type|Vector2|?}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setLight(blockLight {{type|integer|?}}, skyLight {{type|integer|?}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Max light&lt;br /&gt;
root:setLight(15, 15)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- set light based on position (This is a fix for broken lighting on World parts)&lt;br /&gt;
function events.tick()&lt;br /&gt;
  local pos = player:getPos()&lt;br /&gt;
  local blockLight = world.getBlockLightLevel(pos)&lt;br /&gt;
  local skyLight = world.getSkyLightLevel(pos)&lt;br /&gt;
  root:setLight(blockLight, skyLight)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[PlayerAPI#PlayerAPI:getPos|player:getPos]] [[WorldAPI#WorldAPI.getBlockLightLevel|world.getBlockLightLevel]] [[WorldAPI#WorldAPI.getSkyLightLevel|world.getSkyLightLevel]]&lt;br /&gt;
&lt;br /&gt;
==== getLight ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setLight&amp;lt;/code&amp;gt;. Returns &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getLight()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector2}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
&lt;br /&gt;
print(root:getLight()) --&amp;gt; nil&lt;br /&gt;
&lt;br /&gt;
root:setLight(12, 8)&lt;br /&gt;
&lt;br /&gt;
let light = root:getLight()&lt;br /&gt;
print(light) --&amp;gt; vec(12, 8)&lt;br /&gt;
print(&amp;quot;BlockLightLevel -&amp;gt; &amp;quot;, light.x) --&amp;gt; &amp;quot;BlockLightLevel -&amp;gt; 12&amp;quot;&lt;br /&gt;
print(&amp;quot;SkyLightLevel -&amp;gt; &amp;quot;, light.y) --&amp;gt; &amp;quot;BlockLightLevel -&amp;gt; 8&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setLight|setLight]],&lt;br /&gt;
&lt;br /&gt;
==== setOverlay ====&lt;br /&gt;
Overrides the values used for rendering the red damage tint and the white creeper fuse effect. Really only useful for preventing the damage overlay from rendering on stuff like armor.&lt;br /&gt;
&lt;br /&gt;
Valid values for whiteOverlay: 0-15&lt;br /&gt;
&lt;br /&gt;
Valid values for hurtOverlay: 0-7&lt;br /&gt;
&lt;br /&gt;
whiteOverlay is a gradually increasing white tint from 0 - 15&lt;br /&gt;
&lt;br /&gt;
hurtOverlay is an unchanging red tint from 0 - 7.&lt;br /&gt;
&lt;br /&gt;
When set, hurtOverlay overrides whiteOverlay. For whiteOverlay to not be overriden, hurtOverlay needs to be 8 or more.&lt;br /&gt;
&lt;br /&gt;
Providing &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; will undo the override, allowing Minecraft to control the overlay again.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOverlay(overlayVector {{type|Vector2|?}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOverlay(whiteOverlay {{type|integer|?}}, hurtOverlay {{type|integer}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Damage overlay&lt;br /&gt;
root:setOverlay(0, 0)&lt;br /&gt;
-- Literally no difference&lt;br /&gt;
root:setOverlay(0, 5)&lt;br /&gt;
root:setOverlay(0, 7)&lt;br /&gt;
&lt;br /&gt;
-- Doesnt work. Damage overlay overrides white&lt;br /&gt;
root:setOverlay(15, 0)&lt;br /&gt;
&lt;br /&gt;
-- This works. Max white overlay&lt;br /&gt;
root:setOverlay(15, 15)&lt;br /&gt;
&lt;br /&gt;
-- This can be used to for preventing the damage overlay on armor&lt;br /&gt;
root:setOverlay(0, 15)&lt;br /&gt;
&lt;br /&gt;
-- Give control back to Minecraft&lt;br /&gt;
root:setOverlay(nil)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getOverlay ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setOverlay&amp;lt;/code&amp;gt;. Returns &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOverlay()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector2}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
&lt;br /&gt;
print(root:getOverlay()) --&amp;gt; nil&lt;br /&gt;
&lt;br /&gt;
root:setOverlay(8, 15)&lt;br /&gt;
&lt;br /&gt;
let overlay = root:getOverlay()&lt;br /&gt;
print(overlay) --&amp;gt; vec(8, 15)&lt;br /&gt;
print(&amp;quot;whiteOverlay -&amp;gt; &amp;quot;, overlay.x) --&amp;gt; &amp;quot;whiteOverlay -&amp;gt; 8&amp;quot;&lt;br /&gt;
print(&amp;quot;hurtOverlay -&amp;gt; &amp;quot;, overlay.y) --&amp;gt; &amp;quot;hurtOverlay -&amp;gt; 15&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOverlay|setOverlay]],&lt;br /&gt;
&lt;br /&gt;
=== renderTasks ===&lt;br /&gt;
todo: put all rendertask functions in here &lt;br /&gt;
&lt;br /&gt;
=== Render Methods ===&lt;br /&gt;
todo: Put partToWorldMatrix, preRender, midRender, and PostRender in here&lt;br /&gt;
&lt;br /&gt;
=== Animation Methods ===&lt;br /&gt;
todo: put getAnimPos/Rot/Scale and overrideVanillaPos/Rot/Scale in here&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=319</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=319"/>
		<updated>2024-09-28T16:17:01Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: reduced @see, changed headings, nullable tag&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into a ModelPart.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
{{note|&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; itself is a ModelPart. This allows you to apply transformations to the entire model, using e.g. &amp;lt;code&amp;gt;models:setScale(0.5)&amp;lt;/code&amp;gt;.|tag=Trivia|color=#A155DA}}&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be indexed with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ParentTypes ==&lt;br /&gt;
In Figura, a [[ParentType]] is applied to a ModelPart causing the ModelPart to behave in a predefined way. This behavior includes acting as a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, or parrots, and binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a case-sensitive ParentType.&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType which can cause unintended behavior!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart Properties ===&lt;br /&gt;
Read-only properties of a ModelPart&lt;br /&gt;
&lt;br /&gt;
==== getName ====&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getType ====&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their face data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Editing ModelPart Hierarchy ===&lt;br /&gt;
Methods relating to getting other ModelParts and manipulating the ModelPart tree&lt;br /&gt;
&lt;br /&gt;
==== getParent ====&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|ModelPart|?}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getChildren ====&lt;br /&gt;
Returns an array containing all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart|[]}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
printTable(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== isChildOf ====&lt;br /&gt;
Recursively checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== copy ====&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setParentType|setParentType]],, [[#getParentType|getParentType]],&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children because it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#getName|getName]],, [[#getChildren|getChildren]],, [[#addChild|addChild]],, [[#removeChild|removeChild]],&lt;br /&gt;
&lt;br /&gt;
==== addChild ====&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#copy|copy]],, [[#setPos|setPos]],&lt;br /&gt;
&lt;br /&gt;
==== removeChild ====&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== remove ====&lt;br /&gt;
Removes this ModelPart from the parent&#039;s child list. Returns self&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;remove()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:remove() -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
models.model.root.LeftLeg:addChild(head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#addChild|addChild]],&lt;br /&gt;
&lt;br /&gt;
=== Manipulation ===&lt;br /&gt;
Methods relating to manipulating the ModelPart within physical space&lt;br /&gt;
&lt;br /&gt;
==== setPos ====&lt;br /&gt;
Sets the offset of the the position of the ModelPart. Position translation applies on the local rotation axis.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(pos {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Move 10 units on the local y axis&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getPos ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,10,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setPos|setPos]],&lt;br /&gt;
&lt;br /&gt;
==== setRot ====&lt;br /&gt;
Sets the rotation of the ModelPart. Rotates the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Rotate 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setRot(0, 45, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getRot ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;. Will be the Rotation values defined in BlockBench when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0) -- Most ModelParts will not have a rotation set in blockbench&lt;br /&gt;
head:setRot(45, 0, 0)&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setRot|setRot]],&lt;br /&gt;
&lt;br /&gt;
==== setScale ====&lt;br /&gt;
Sets the scale of the ModelPart. Scales the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Squishes and stretches the entire model&lt;br /&gt;
models.model:setScale(1.5, 0.75, 1.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getScale ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setScale|setScale]],&lt;br /&gt;
&lt;br /&gt;
==== setPivot ====&lt;br /&gt;
Sets the pivot point of the ModelPart. &#039;&#039;This overrides the pivot point defined in blockbench.&#039;&#039; It is recommended to use [[#setOffsetPivot|setOffsetPivot]], instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- For a normal size humanoid model, the Head&#039;s pivot point is usually at 0,24,0&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setPivot(0, 28, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getPivot ====&lt;br /&gt;
Returns the Pivot Point defined in BlockBench, or the value set by &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; if it was already overwritten.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- The Head group&#039;s pivot point for a humanoid model is usually at 0,24,0&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,24,0)&lt;br /&gt;
head:setPivot(0,0,0)&lt;br /&gt;
-- We have completely ruined the rendering of this ModelPart&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setPivot|setPivot]],&lt;br /&gt;
&lt;br /&gt;
==== setOffsetRot ====&lt;br /&gt;
Sets a rotation value that will be added to the ModelPart&#039;s rotation.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- ModelParts inherit their rotation from blockbench. The Head usually has a rotation of 0,0,0 for consistency with the vanilla model&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
-- Set the offset to 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setOffsetRot(0, 45, 0)&lt;br /&gt;
-- The original rotation is unchanged.&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&lt;br /&gt;
-- setOffsetRot is not additive.&lt;br /&gt;
head:setOffsetRot(0, 25, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,25,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#getRot|getRot]], [[#getOffsetRot|getOffsetRot]],&lt;br /&gt;
&lt;br /&gt;
==== getOffsetRot ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;. Will be 0,0,0 when the script begins&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetRot(45, 0, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOffsetRot|setOffsetRot]],&lt;br /&gt;
&lt;br /&gt;
==== setOffsetScale ====&lt;br /&gt;
Sets a scale value that will be multiplied with the ModelPart&#039;s scale.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Half the size of the head&lt;br /&gt;
head:setOffsetScale(0.5)&lt;br /&gt;
-- Results in no changes&lt;br /&gt;
-- I have no idea what this is used for&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getOffsetScale ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setOffsetScale(2)&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOffsetScale|setOffsetScale]],&lt;br /&gt;
&lt;br /&gt;
==== setOffsetPivot ====&lt;br /&gt;
Sets a value that will be added to the ModelPart&#039;s pivot point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube and offset the pivot up by 4,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setOffsetPivot(0, 4, 0)&lt;br /&gt;
-- Notice that we did not need to know the original pivot point to do this&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getOffsetPivot ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetPivot(0,4,0)&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,4,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOffsetPivot|setOffsetPivot]],&lt;br /&gt;
&lt;br /&gt;
==== setMatrix ====&lt;br /&gt;
Allows you to manually define the matrix used for positioning this ModelPart. Returns self for method chaining.&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt; will undo &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;getPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;getOffsetPivot&amp;lt;/code&amp;gt; will return invalid values while &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt; is in effect. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;getTruePos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueScale&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;getTruePivot&amp;lt;/code&amp;gt; are probably also affected, but nobody tested them yet.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setMatrix(matrix {{type|Matrix4}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTruePos ====&lt;br /&gt;
Returns the position after all calculations are done. This includes &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt; and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTrueRot ====&lt;br /&gt;
Returns the rotation after all calculations are done. This includes &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTrueScale ====&lt;br /&gt;
Returns the scale after all calculations are done. This includes &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTrueScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== getTruePivot ====&lt;br /&gt;
Returns the pivot point after all calculations are done. This includes &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visual Manipulation ===&lt;br /&gt;
Methods relating to modifying how a ModelPart looks&lt;br /&gt;
&lt;br /&gt;
todo: put anything related to renderType, textures, and other visual modifications in here&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setVisible ====&lt;br /&gt;
Sets if this ModelPart is visible or not. Children of this ModelPart will also be invisible while this part is invisible.&lt;br /&gt;
&lt;br /&gt;
A value of &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; is interpreted as &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; on 0.1.4 and below, and &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; on 0.1.5 and above. This message will disappear &amp;lt;s&amp;gt;if&amp;lt;/s&amp;gt; when 0.1.6 is released.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setVisible(visible {{type|boolean}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
head:setVisible(false) -- Bye bye Head!&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getVisible ====&lt;br /&gt;
Recursively goes up the ModelPart tree until it finds a ModelPart that is invisible, or the ModelPart is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other words, if a parent part is invisible, this function returns &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;. If all parent parts are visible, this function will return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Kinda stupid. This is fixed in 0.1.5 to never return &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool|?}} {{until|0.1.5}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool}} {{since|0.1.5}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; nil --&amp;lt; this is stupid&lt;br /&gt;
root:setVisible(false) -- Bye bye root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; false&lt;br /&gt;
root:setVisible(true) -- Welcome back root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; true --&amp;lt; aaaaaaaa&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setColor ====&lt;br /&gt;
Sets a value to multiply with all pixels on the ModelPart&#039;s texture. Children of this ModelPart inherit the color, multiplied with their own.&lt;br /&gt;
&lt;br /&gt;
1,1,1 multiplies all color channels by 1, resulting in the texture unchanged. 0,0,0 results in all channels being black.&lt;br /&gt;
&lt;br /&gt;
Expects values between 0 and 1. Numbers larger than 1 results in undocumented behaviour. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If only &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is defined as a number and both &amp;lt;code&amp;gt;g&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; are omitted, &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is used for all 3 color channels.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(color {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(colorAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(r {{type|number}}, g {{type|number}}, b {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Darken the entire model&lt;br /&gt;
root:setColor(0.5,0.5,0.5)&lt;br /&gt;
-- Tint the Head red by reducing the other color channels.&lt;br /&gt;
-- Color is inherited from parents, so the effective color is (0.5, 0.45, 0.45)&lt;br /&gt;
root.Head:setColor(1,0.7,0.7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- If you want to &#039;reset&#039; a child&#039;s color value, extra work is needed.&lt;br /&gt;
&lt;br /&gt;
-- Color is max red&lt;br /&gt;
local color = vec(1,0,0)&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- root has color&lt;br /&gt;
root:setColor(color)&lt;br /&gt;
-- Through magic and wizardry, this &#039;resets&#039; the color of Head back to white, dispite it&#039;s parent having a non-white color&lt;br /&gt;
root.Head:setColor(-color + 2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getColor ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setColor&amp;lt;/code&amp;gt;. Returns 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getColor()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
root:setColor(0.5)&lt;br /&gt;
print(root:getColor()) --&amp;gt; (0.5, 0.5, 0.5)&lt;br /&gt;
root.Head:setColor(1,0.7,0.7)&lt;br /&gt;
// getColor is not recursive&lt;br /&gt;
print(root.Head:getColor()) --&amp;gt; (1, 0.7, 0.7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setColor|setColor]],&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setOpacity ====&lt;br /&gt;
Sets the opacity of the ModelPart. Children of this ModelPart inherit the opacity, multiplied with their own.&lt;br /&gt;
&lt;br /&gt;
Minecraft has a minimum visible opacity of 0.1. Opacity values lower than 0.1 will not render at all. Needs verification.&lt;br /&gt;
&lt;br /&gt;
Only supported on [[RenderType|RenderTypes]] that support translucency. The default primary RenderType is &amp;lt;code&amp;gt;TRANSLUCENT&amp;lt;/code&amp;gt;, so most don&#039;t have to worry about it.&lt;br /&gt;
&lt;br /&gt;
Expects a value between 0 and 1.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOpacity(opacity {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Half opacity&lt;br /&gt;
root:setOpacity(0.5)&lt;br /&gt;
-- Half of half opacity&lt;br /&gt;
root.Head:setColor(0.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getOpacity ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setOpacity&amp;lt;/code&amp;gt;. Returns 1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOpacity()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|number}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
root:setOpacity(0.5)&lt;br /&gt;
print(root:getOpacity()) --&amp;gt; 0.5&lt;br /&gt;
root.Head:setOpacity(0.5)&lt;br /&gt;
// getOpacity is not recursive&lt;br /&gt;
print(root.Head:getOpacity()) --&amp;gt; 0.5&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOpacity|setOpacity]],&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setLight ====&lt;br /&gt;
Overrides the lightlevels used to render the ModelPart. Children of this ModelPart inherit the lightlevel.&lt;br /&gt;
&lt;br /&gt;
Expects 2 values between 0 and 15, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Providing &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; will undo the override, allowing Minecraft to control the lightlevel again.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setLight(light {{type|Vector2|?}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setLight(blockLight {{type|integer|?}}, skyLight {{type|integer|?}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Max light&lt;br /&gt;
root:setLight(15, 15)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- set light based on position (This is a fix for broken lighting on World parts)&lt;br /&gt;
function events.tick()&lt;br /&gt;
  local pos = player:getPos()&lt;br /&gt;
  local blockLight = world.getBlockLightLevel(pos)&lt;br /&gt;
  local skyLight = world.getSkyLightLevel(pos)&lt;br /&gt;
  root:setLight(blockLight, skyLight)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[PlayerAPI#PlayerAPI:getPos|player:getPos]] [[WorldAPI#WorldAPI.getBlockLightLevel|world.getBlockLightLevel]] [[WorldAPI#WorldAPI.getSkyLightLevel|world.getSkyLightLevel]]&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getLight ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setLight&amp;lt;/code&amp;gt;. Returns &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getLight()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector2}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
&lt;br /&gt;
print(root:getLight()) --&amp;gt; nil&lt;br /&gt;
&lt;br /&gt;
root:setLight(12, 8)&lt;br /&gt;
&lt;br /&gt;
let light = root:getLight()&lt;br /&gt;
print(light) --&amp;gt; vec(12, 8)&lt;br /&gt;
print(&amp;quot;BlockLightLevel -&amp;gt; &amp;quot;, light.x) --&amp;gt; &amp;quot;BlockLightLevel -&amp;gt; 12&amp;quot;&lt;br /&gt;
print(&amp;quot;SkyLightLevel -&amp;gt; &amp;quot;, light.y) --&amp;gt; &amp;quot;BlockLightLevel -&amp;gt; 8&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setLight|setLight]],&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setOverlay ====&lt;br /&gt;
Overrides the values used for rendering the red damage tint and the white creeper fuse effect. Really only useful for preventing the damage overlay from rendering on stuff like armor.&lt;br /&gt;
&lt;br /&gt;
Valid values for whiteOverlay: 0-15&lt;br /&gt;
&lt;br /&gt;
Valid values for hurtOverlay: 0-7&lt;br /&gt;
&lt;br /&gt;
whiteOverlay is a gradually increasing white tint from 0 - 15&lt;br /&gt;
&lt;br /&gt;
hurtOverlay is an unchanging red tint from 0 - 7.&lt;br /&gt;
&lt;br /&gt;
When set, hurtOverlay overrides whiteOverlay. For whiteOverlay to not be overriden, hurtOverlay needs to be 8 or more.&lt;br /&gt;
&lt;br /&gt;
Providing &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; will undo the override, allowing Minecraft to control the overlay again.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOverlay(overlayVector {{type|Vector2|?}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOverlay(whiteOverlay {{type|integer|?}}, hurtOverlay {{type|integer}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Damage overlay&lt;br /&gt;
root:setOverlay(0, 0)&lt;br /&gt;
-- Literally no difference&lt;br /&gt;
root:setOverlay(0, 5)&lt;br /&gt;
root:setOverlay(0, 7)&lt;br /&gt;
&lt;br /&gt;
-- Doesnt work. Damage overlay overrides white&lt;br /&gt;
root:setOverlay(15, 0)&lt;br /&gt;
&lt;br /&gt;
-- This works. Max white overlay&lt;br /&gt;
root:setOverlay(15, 15)&lt;br /&gt;
&lt;br /&gt;
-- This can be used to for preventing the damage overlay on armor&lt;br /&gt;
root:setOverlay(0, 15)&lt;br /&gt;
&lt;br /&gt;
-- Give control back to Minecraft&lt;br /&gt;
root:setOverlay(nil)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getOverlay ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setOverlay&amp;lt;/code&amp;gt;. Returns &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOverlay()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector2}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
&lt;br /&gt;
print(root:getOverlay()) --&amp;gt; nil&lt;br /&gt;
&lt;br /&gt;
root:setOverlay(8, 15)&lt;br /&gt;
&lt;br /&gt;
let overlay = root:getOverlay()&lt;br /&gt;
print(overlay) --&amp;gt; vec(8, 15)&lt;br /&gt;
print(&amp;quot;whiteOverlay -&amp;gt; &amp;quot;, overlay.x) --&amp;gt; &amp;quot;whiteOverlay -&amp;gt; 8&amp;quot;&lt;br /&gt;
print(&amp;quot;hurtOverlay -&amp;gt; &amp;quot;, overlay.y) --&amp;gt; &amp;quot;hurtOverlay -&amp;gt; 15&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[#setOverlay|setOverlay]],&lt;br /&gt;
&lt;br /&gt;
=== renderTasks ===&lt;br /&gt;
todo: put all rendertask functions in here &lt;br /&gt;
&lt;br /&gt;
=== Render Methods ===&lt;br /&gt;
todo: Put partToWorldMatrix, preRender, midRender, and PostRender in here&lt;br /&gt;
&lt;br /&gt;
=== Animation Methods ===&lt;br /&gt;
todo: put getAnimPos/Rot/Scale and overrideVanillaPos/Rot/Scale in here&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=315</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=315"/>
		<updated>2024-09-28T15:15:42Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: KitCat962 moved page ModelParts to ModelPart over redirect: Misspelled title: modelpart&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into a ModelPart.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
{{note|&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; itself is a ModelPart. This allows you to apply transformations to the entire model, using e.g. &amp;lt;code&amp;gt;models:setScale(0.5)&amp;lt;/code&amp;gt;.|tag=Trivia|color=#A155DA}}&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be indexed with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ModelPart ParentTypes ==&lt;br /&gt;
In Figura, a ParentType is applied to a ModelPart causing the ModelPart to behave in a predefined way. This behavior includes acting as a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, or parrots, and binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a case-sensitive ParentType.&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType which can cause unintended behavior!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[ModelParts#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart Properties ===&lt;br /&gt;
Read-only properties of a ModelPart&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getName&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getType&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their face data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Editing ModelPart Hierarchy ===&lt;br /&gt;
Methods relating to getting other ModelParts and manipulating the ModelPart tree&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getParent&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|ModelPart}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getChildren&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns an array containing all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart|[]}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
printTable(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[Globals#printTable|printTable]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:isChildOf&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Recursively checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:copy&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setParentType|setParentType]], [[ModelParts#ModelPart:getParentType|getParentType]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children because it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getName|getName]], [[ModelParts#ModelPart:getChildren|getChildren]], [[ModelParts#ModelPart:addChild|addChild]], [[ModelParts#ModelPart:removeChild|removeChild]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:addChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:copy|copy]], [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:removeChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:remove&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes this ModelPart from the parent&#039;s child list. Returns self&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;remove()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:remove() -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
models.model.root.LeftLeg:addChild(head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:addChild|addChild]]&lt;br /&gt;
&lt;br /&gt;
=== Manipulation ===&lt;br /&gt;
Methods relating to manipulating the ModelPart within physical space&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setPos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the offset of the the position of the ModelPart. Position translation applies on the local rotation axis.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(pos {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Move 10 units on the local y axis&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getPos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,10,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the rotation of the ModelPart. Rotates the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Rotate 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setRot(0, 45, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;. Will be the Rotation values defined in BlockBench when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0) -- Most ModelParts will not have a rotation set in blockbench&lt;br /&gt;
head:setRot(45, 0, 0)&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setRot|setRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the scale of the ModelPart. Scales the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Squishes and stretches the entire model&lt;br /&gt;
models.model:setScale(1.5, 0.75, 1.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setScale|setScale]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the pivot point of the ModelPart. &#039;&#039;This overrides the pivot point defined in blockbench.&#039;&#039; It is recommended to use [[ModelParts#ModelPart:setOffsetPivot|setOffsetPivot]] instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- For a normal size humanoid model, the Head&#039;s pivot point is usually at 0,24,0&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setPivot(0, 28, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the Pivot Point defined in BlockBench, or the value set by &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; if it was already overwritten.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- The Head group&#039;s pivot point for a humanoid model is usually at 0,24,0&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,24,0)&lt;br /&gt;
head:setPivot(0,0,0)&lt;br /&gt;
-- We have completely ruined the rendering of this ModelPart&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setPivot|setPivot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a rotation value that will be added to the ModelPart&#039;s rotation.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- ModelParts inherit their rotation from blockbench. The Head usually has a rotation of 0,0,0 for consistency with the vanilla model&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
-- Set the offset to 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setOffsetRot(0, 45, 0)&lt;br /&gt;
-- The original rotation is unchanged.&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&lt;br /&gt;
-- setOffsetRot is not additive.&lt;br /&gt;
head:setOffsetRot(0, 25, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,25,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getRot|getRot]] [[ModelParts#ModelPart:getOffsetRot|getOffsetRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;. Will be 0,0,0 when the script begins&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetRot(45, 0, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetRot|setOffsetRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a scale value that will be multiplied with the ModelPart&#039;s scale.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Half the size of the head&lt;br /&gt;
head:setOffsetScale(0.5)&lt;br /&gt;
-- Results in no changes&lt;br /&gt;
-- I have no idea what this is used for&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setOffsetScale(2)&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetScale|setOffsetScale]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a value that will be added to the ModelPart&#039;s pivot point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube and offset the pivot up by 4,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setOffsetPivot(0, 4, 0)&lt;br /&gt;
-- Notice that we did not need to know the original pivot point to do this&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetPivot(0,4,0)&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,4,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetPivot|setOffsetPivot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setMatrix&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Allows you to manually define the matrix used for positioning this ModelPart. Returns self for method chaining.&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt; will undo &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;getPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;getOffsetPivot&amp;lt;/code&amp;gt; will return invalid values while &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt; is in effect. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;getTruePos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueScale&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;getTruePivot&amp;lt;/code&amp;gt; are probably also affected, but nobody tested them yet.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setMatrix(matrix {{type|Matrix4}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTruePos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the position after all calculations are done. This includes &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt; and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTrueRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the rotation after all calculations are done. This includes &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTrueScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the scale after all calculations are done. This includes &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTrueScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTruePivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the pivot point after all calculations are done. This includes &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visual Manipulation ===&lt;br /&gt;
Methods relating to modifying how a ModelPart looks&lt;br /&gt;
&lt;br /&gt;
todo: put anything related to renderType, textures, and other visual modifications in here&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setVisible ====&lt;br /&gt;
Sets if this ModelPart is visible or not. Children of this ModelPart will also be invisible while this part is invisible.&lt;br /&gt;
&lt;br /&gt;
A value of &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; is interpreted as &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; on 0.1.4 and below, and &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; on 0.1.5 and above. This message will disappear &amp;lt;s&amp;gt;if&amp;lt;/s&amp;gt; when 0.1.6 is released.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setVisible(visible {{type|boolean}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
head:setVisible(false) -- Bye bye Head!&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getVisible ====&lt;br /&gt;
Recursively goes up the ModelPart tree until it finds a ModelPart that is invisible, or the ModelPart is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other words, if a parent part is invisible, this function returns &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;. If all parent parts are visible, this function will return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Kinda stupid. This is fixed in 0.1.5 to never return &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}} {{until|0.1.5}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool}} {{since|0.1.5}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; nil --&amp;lt; this is stupid&lt;br /&gt;
root:setVisible(false) -- Bye bye root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; false&lt;br /&gt;
root:setVisible(true) -- Welcome back root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; true --&amp;lt; aaaaaaaa&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setColor ====&lt;br /&gt;
Sets a value to multiply with all pixels on the ModelPart&#039;s texture. Children of this ModelPart inherit the color, multiplied with their own.&lt;br /&gt;
&lt;br /&gt;
1,1,1 multiplies all color channels by 1, resulting in the texture unchanged. 0,0,0 results in all channels being black.&lt;br /&gt;
&lt;br /&gt;
Expects values between 0 and 1. Numbers larger than 1 results in undocumented behaviour. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If only &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is defined as a number and both &amp;lt;code&amp;gt;g&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; are omitted, &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is used for all 3 color channels.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(color {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(colorAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(r {{type|number}}, g {{type|number}}, b {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Darken the entire model&lt;br /&gt;
root:setColor(0.5,0.5,0.5)&lt;br /&gt;
-- Tint the Head red by reducing the other color channels.&lt;br /&gt;
-- Color is inherited from parents, so the effective color is (0.5, 0.45, 0.45)&lt;br /&gt;
root.Head:setColor(1,0.7,0.7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- If you want to &#039;reset&#039; a child&#039;s color value, extra work is needed.&lt;br /&gt;
&lt;br /&gt;
-- Color is max red&lt;br /&gt;
local color = vec(1,0,0)&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- root has color&lt;br /&gt;
root:setColor(color)&lt;br /&gt;
-- Through magic and wizardry, this &#039;resets&#039; the color of Head back to white, dispite it&#039;s parent having a non-white color&lt;br /&gt;
root.Head:setColor(-color + 2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getColor ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setColor&amp;lt;/code&amp;gt;. Returns 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getColor()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
root:setColor(0.5)&lt;br /&gt;
print(root:getColor()) --&amp;gt; (0.5, 0.5, 0.5)&lt;br /&gt;
root.Head:setColor(1,0.7,0.7)&lt;br /&gt;
// getColor is not recursive&lt;br /&gt;
print(root.Head:getColor()) --&amp;gt; (1, 0.7, 0.7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setColor|setColor]]&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setOpacity ====&lt;br /&gt;
Sets the opacity of the ModelPart. Children of this ModelPart inherit the opacity, multiplied with their own.&lt;br /&gt;
&lt;br /&gt;
Minecraft has a minimum visible opacity of 0.1. Opacity values lower than 0.1 will not render at all. Needs verification.&lt;br /&gt;
&lt;br /&gt;
Only supported on [[RenderType|RenderTypes]] that support translucency. The default primary RenderType is &amp;lt;code&amp;gt;TRANSLUCENT&amp;lt;/code&amp;gt;, so most don&#039;t have to worry about it.&lt;br /&gt;
&lt;br /&gt;
Expects a value between 0 and 1.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOpacity(opacity {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Half opacity&lt;br /&gt;
root:setOpacity(0.5)&lt;br /&gt;
-- Half of half opacity&lt;br /&gt;
root.Head:setColor(0.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getOpacity ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setOpacity&amp;lt;/code&amp;gt;. Returns 1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOpacity()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|number}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
root:setOpacity(0.5)&lt;br /&gt;
print(root:getOpacity()) --&amp;gt; 0.5&lt;br /&gt;
root.Head:setOpacity(0.5)&lt;br /&gt;
// getOpacity is not recursive&lt;br /&gt;
print(root.Head:getOpacity()) --&amp;gt; 0.5&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOpacity|setOpacity]]&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setLight ====&lt;br /&gt;
Overrides the lightlevels used to render the ModelPart. Children of this ModelPart inherit the lightlevel.&lt;br /&gt;
&lt;br /&gt;
Expects 2 values between 0 and 15, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Providing &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; will undo the override, allowing Minecraft to control the lightlevel again.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setLight(light {{type|Vector2}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setLight(blockLight {{type|integer}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}}, skyLight {{type|integer}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Max light&lt;br /&gt;
root:setLight(15, 15)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- set light based on position (This is a fix for broken lighting on World parts)&lt;br /&gt;
function events.tick()&lt;br /&gt;
  local pos = player:getPos()&lt;br /&gt;
  local blockLight = world.getBlockLightLevel(pos)&lt;br /&gt;
  local skyLight = world.getSkyLightLevel(pos)&lt;br /&gt;
  root:setLight(blockLight, skyLight)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[PlayerAPI#PlayerAPI:getPos|player:getPos]] [[WorldAPI#WorldAPI.getBlockLightLevel|world.getBlockLightLevel]] [[WorldAPI#WorldAPI.getSkyLightLevel|world.getSkyLightLevel]]&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getLight ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setLight&amp;lt;/code&amp;gt;. Returns &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getLight()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector2}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
&lt;br /&gt;
print(root:getLight()) --&amp;gt; nil&lt;br /&gt;
&lt;br /&gt;
root:setLight(12, 8)&lt;br /&gt;
&lt;br /&gt;
let light = root:getLight()&lt;br /&gt;
print(light) --&amp;gt; vec(12, 8)&lt;br /&gt;
print(&amp;quot;BlockLightLevel -&amp;gt; &amp;quot;, light.x) --&amp;gt; &amp;quot;BlockLightLevel -&amp;gt; 12&amp;quot;&lt;br /&gt;
print(&amp;quot;SkyLightLevel -&amp;gt; &amp;quot;, light.y) --&amp;gt; &amp;quot;BlockLightLevel -&amp;gt; 8&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setLight|setLight]]&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setOverlay ====&lt;br /&gt;
Overrides the values used for rendering the red damage tint and the white creeper fuse effect. Really only useful for preventing the damage overlay from rendering on stuff like armor.&lt;br /&gt;
&lt;br /&gt;
Valid values for whiteOverlay: 0-15&lt;br /&gt;
&lt;br /&gt;
Valid values for hurtOverlay: 0-7&lt;br /&gt;
&lt;br /&gt;
whiteOverlay is a gradually increasing white tint from 0 - 15&lt;br /&gt;
&lt;br /&gt;
hurtOverlay is an unchanging red tint from 0 - 7.&lt;br /&gt;
&lt;br /&gt;
When set, hurtOverlay overrides whiteOverlay. For whiteOverlay to not be overriden, hurtOverlay needs to be 8 or more.&lt;br /&gt;
&lt;br /&gt;
Providing &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; will undo the override, allowing Minecraft to control the overlay again.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOverlay(overlayVector {{type|Vector2}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOverlay(whiteOverlay {{type|integer}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}}, hurtOverlay {{type|integer}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Damage overlay&lt;br /&gt;
root:setOverlay(0, 0)&lt;br /&gt;
-- Literally no difference&lt;br /&gt;
root:setOverlay(0, 5)&lt;br /&gt;
root:setOverlay(0, 7)&lt;br /&gt;
&lt;br /&gt;
-- Doesnt work. Damage overlay overrides white&lt;br /&gt;
root:setOverlay(15, 0)&lt;br /&gt;
&lt;br /&gt;
-- This works. Max white overlay&lt;br /&gt;
root:setOverlay(15, 15)&lt;br /&gt;
&lt;br /&gt;
-- This can be used to for preventing the damage overlay on armor&lt;br /&gt;
root:setOverlay(0, 15)&lt;br /&gt;
&lt;br /&gt;
-- Give control back to Minecraft&lt;br /&gt;
root:setOverlay(nil)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getOverlay ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setOverlay&amp;lt;/code&amp;gt;. Returns &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOverlay()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector2}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
&lt;br /&gt;
print(root:getOverlay()) --&amp;gt; nil&lt;br /&gt;
&lt;br /&gt;
root:setOverlay(8, 15)&lt;br /&gt;
&lt;br /&gt;
let overlay = root:getOverlay()&lt;br /&gt;
print(overlay) --&amp;gt; vec(8, 15)&lt;br /&gt;
print(&amp;quot;whiteOverlay -&amp;gt; &amp;quot;, overlay.x) --&amp;gt; &amp;quot;whiteOverlay -&amp;gt; 8&amp;quot;&lt;br /&gt;
print(&amp;quot;hurtOverlay -&amp;gt; &amp;quot;, overlay.y) --&amp;gt; &amp;quot;hurtOverlay -&amp;gt; 15&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOverlay|setOverlay]]&lt;br /&gt;
&lt;br /&gt;
=== renderTasks ===&lt;br /&gt;
todo: put all rendertask functions in here &lt;br /&gt;
&lt;br /&gt;
=== Render Methods ===&lt;br /&gt;
todo: Put partToWorldMatrix, preRender, midRender, and PostRender in here&lt;br /&gt;
&lt;br /&gt;
=== Animation Methods ===&lt;br /&gt;
todo: put getAnimPos/Rot/Scale and overrideVanillaPos/Rot/Scale in here&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=311</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=311"/>
		<updated>2024-09-28T14:22:37Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: /* ModelPart:getParent */ |&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into a ModelPart.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
{{note|&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; itself is a ModelPart. This allows you to apply transformations to the entire model, using e.g. &amp;lt;code&amp;gt;models:setScale(0.5)&amp;lt;/code&amp;gt;.|tag=Trivia|color=#A155DA}}&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be indexed with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ModelPart ParentTypes ==&lt;br /&gt;
In Figura, a ParentType is applied to a ModelPart causing the ModelPart to behave in a predefined way. This behavior includes acting as a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, or parrots, and binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a case-sensitive ParentType.&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType which can cause unintended behavior!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[ModelParts#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart Properties ===&lt;br /&gt;
Read-only properties of a ModelPart&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getName&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getType&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their face data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Editing ModelPart Hierarchy ===&lt;br /&gt;
Methods relating to getting other ModelParts and manipulating the ModelPart tree&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getParent&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|ModelPart}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getChildren&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns an array containing all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart|[]}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
printTable(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[Globals#printTable|printTable]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:isChildOf&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Recursively checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:copy&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setParentType|setParentType]], [[ModelParts#ModelPart:getParentType|getParentType]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children because it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getName|getName]], [[ModelParts#ModelPart:getChildren|getChildren]], [[ModelParts#ModelPart:addChild|addChild]], [[ModelParts#ModelPart:removeChild|removeChild]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:addChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:copy|copy]], [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:removeChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:remove&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes this ModelPart from the parent&#039;s child list. Returns self&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;remove()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:remove() -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
models.model.root.LeftLeg:addChild(head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:addChild|addChild]]&lt;br /&gt;
&lt;br /&gt;
=== Manipulation ===&lt;br /&gt;
Methods relating to manipulating the ModelPart within physical space&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setPos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the offset of the the position of the ModelPart. Position translation applies on the local rotation axis.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(pos {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Move 10 units on the local y axis&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getPos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,10,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the rotation of the ModelPart. Rotates the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Rotate 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setRot(0, 45, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;. Will be the Rotation values defined in BlockBench when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0) -- Most ModelParts will not have a rotation set in blockbench&lt;br /&gt;
head:setRot(45, 0, 0)&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setRot|setRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the scale of the ModelPart. Scales the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Squishes and stretches the entire model&lt;br /&gt;
models.model:setScale(1.5, 0.75, 1.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setScale|setScale]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the pivot point of the ModelPart. &#039;&#039;This overrides the pivot point defined in blockbench.&#039;&#039; It is recommended to use [[ModelParts#ModelPart:setOffsetPivot|setOffsetPivot]] instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- For a normal size humanoid model, the Head&#039;s pivot point is usually at 0,24,0&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setPivot(0, 28, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the Pivot Point defined in BlockBench, or the value set by &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; if it was already overwritten.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- The Head group&#039;s pivot point for a humanoid model is usually at 0,24,0&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,24,0)&lt;br /&gt;
head:setPivot(0,0,0)&lt;br /&gt;
-- We have completely ruined the rendering of this ModelPart&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setPivot|setPivot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a rotation value that will be added to the ModelPart&#039;s rotation.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- ModelParts inherit their rotation from blockbench. The Head usually has a rotation of 0,0,0 for consistency with the vanilla model&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
-- Set the offset to 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setOffsetRot(0, 45, 0)&lt;br /&gt;
-- The original rotation is unchanged.&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&lt;br /&gt;
-- setOffsetRot is not additive.&lt;br /&gt;
head:setOffsetRot(0, 25, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,25,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getRot|getRot]] [[ModelParts#ModelPart:getOffsetRot|getOffsetRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;. Will be 0,0,0 when the script begins&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetRot(45, 0, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetRot|setOffsetRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a scale value that will be multiplied with the ModelPart&#039;s scale.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Half the size of the head&lt;br /&gt;
head:setOffsetScale(0.5)&lt;br /&gt;
-- Results in no changes&lt;br /&gt;
-- I have no idea what this is used for&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setOffsetScale(2)&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetScale|setOffsetScale]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a value that will be added to the ModelPart&#039;s pivot point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube and offset the pivot up by 4,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setOffsetPivot(0, 4, 0)&lt;br /&gt;
-- Notice that we did not need to know the original pivot point to do this&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetPivot(0,4,0)&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,4,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetPivot|setOffsetPivot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setMatrix&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Allows you to manually define the matrix used for positioning this ModelPart. Returns self for method chaining.&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt; will undo &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;getPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;getOffsetPivot&amp;lt;/code&amp;gt; will return invalid values while &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt; is in effect. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;getTruePos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueScale&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;getTruePivot&amp;lt;/code&amp;gt; are probably also affected, but nobody tested them yet.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setMatrix(matrix {{type|Matrix4}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTruePos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the position after all calculations are done. This includes &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt; and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTrueRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the rotation after all calculations are done. This includes &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTrueScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the scale after all calculations are done. This includes &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTrueScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTruePivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the pivot point after all calculations are done. This includes &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visual Manipulation ===&lt;br /&gt;
Methods relating to modifying how a ModelPart looks&lt;br /&gt;
&lt;br /&gt;
todo: put anything related to renderType, textures, and other visual modifications in here&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setVisible ====&lt;br /&gt;
Sets if this ModelPart is visible or not. Children of this ModelPart will also be invisible while this part is invisible.&lt;br /&gt;
&lt;br /&gt;
A value of &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; is interpreted as &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; on 0.1.4 and below, and &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; on 0.1.5 and above. This message will disappear &amp;lt;s&amp;gt;if&amp;lt;/s&amp;gt; when 0.1.6 is released.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setVisible(visible {{type|boolean}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
head:setVisible(false) -- Bye bye Head!&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getVisible ====&lt;br /&gt;
Recursively goes up the ModelPart tree until it finds a ModelPart that is invisible, or the ModelPart is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other words, if a parent part is invisible, this function returns &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;. If all parent parts are visible, this function will return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Kinda stupid. This is fixed in 0.1.5 to never return &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}} {{until|0.1.5}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool}} {{since|0.1.5}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; nil --&amp;lt; this is stupid&lt;br /&gt;
root:setVisible(false) -- Bye bye root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; false&lt;br /&gt;
root:setVisible(true) -- Welcome back root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; true --&amp;lt; aaaaaaaa&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setColor ====&lt;br /&gt;
Sets a value to multiply with all pixels on the ModelPart&#039;s texture. Children of this ModelPart inherit the color, multiplied with their own.&lt;br /&gt;
&lt;br /&gt;
1,1,1 multiplies all color channels by 1, resulting in the texture unchanged. 0,0,0 results in all channels being black.&lt;br /&gt;
&lt;br /&gt;
Expects values between 0 and 1. Numbers larger than 1 results in undocumented behaviour. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If only &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is defined as a number and both &amp;lt;code&amp;gt;g&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; are omitted, &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is used for all 3 color channels.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(color {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(colorAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(r {{type|number}}, g {{type|number}}, b {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Darken the entire model&lt;br /&gt;
root:setColor(0.5,0.5,0.5)&lt;br /&gt;
-- Tint the Head red by reducing the other color channels.&lt;br /&gt;
-- Color is inherited from parents, so the effective color is (0.5, 0.45, 0.45)&lt;br /&gt;
root.Head:setColor(1,0.7,0.7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- If you want to &#039;reset&#039; a child&#039;s color value, extra work is needed.&lt;br /&gt;
&lt;br /&gt;
-- Color is max red&lt;br /&gt;
local color = vec(1,0,0)&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- root has color&lt;br /&gt;
root:setColor(color)&lt;br /&gt;
-- Through magic and wizardry, this &#039;resets&#039; the color of Head back to white, dispite it&#039;s parent having a non-white color&lt;br /&gt;
root.Head:setColor(-color + 2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getColor ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setColor&amp;lt;/code&amp;gt;. Returns 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getColor()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
root:setColor(0.5)&lt;br /&gt;
print(root:getColor()) --&amp;gt; (0.5, 0.5, 0.5)&lt;br /&gt;
root.Head:setColor(1,0.7,0.7)&lt;br /&gt;
// getColor is not recursive&lt;br /&gt;
print(root.Head:getColor()) --&amp;gt; (1, 0.7, 0.7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setColor|setColor]]&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setOpacity ====&lt;br /&gt;
Sets the opacity of the ModelPart. Children of this ModelPart inherit the opacity, multiplied with their own.&lt;br /&gt;
&lt;br /&gt;
Minecraft has a minimum visible opacity of 0.1. Opacity values lower than 0.1 will not render at all. Needs verification.&lt;br /&gt;
&lt;br /&gt;
Only supported on [[RenderType|RenderTypes]] that support translucency. The default primary RenderType is &amp;lt;code&amp;gt;TRANSLUCENT&amp;lt;/code&amp;gt;, so most don&#039;t have to worry about it.&lt;br /&gt;
&lt;br /&gt;
Expects a value between 0 and 1.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOpacity(opacity {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Half opacity&lt;br /&gt;
root:setOpacity(0.5)&lt;br /&gt;
-- Half of half opacity&lt;br /&gt;
root.Head:setColor(0.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getOpacity ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setOpacity&amp;lt;/code&amp;gt;. Returns 1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOpacity()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|number}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
root:setOpacity(0.5)&lt;br /&gt;
print(root:getOpacity()) --&amp;gt; 0.5&lt;br /&gt;
root.Head:setOpacity(0.5)&lt;br /&gt;
// getOpacity is not recursive&lt;br /&gt;
print(root.Head:getOpacity()) --&amp;gt; 0.5&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOpacity|setOpacity]]&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setLight ====&lt;br /&gt;
Overrides the lightlevels used to render the ModelPart. Children of this ModelPart inherit the lightlevel.&lt;br /&gt;
&lt;br /&gt;
Expects 2 values between 0 and 15, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Providing &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; will undo the override, allowing Minecraft to control the lightlevel again.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setLight(light {{type|Vector2}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setLight(blockLight {{type|integer}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}}, skyLight {{type|integer}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Max light&lt;br /&gt;
root:setLight(15, 15)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- set light based on position (This is a fix for broken lighting on World parts)&lt;br /&gt;
function events.tick()&lt;br /&gt;
  local pos = player:getPos()&lt;br /&gt;
  local blockLight = world.getBlockLightLevel(pos)&lt;br /&gt;
  local skyLight = world.getSkyLightLevel(pos)&lt;br /&gt;
  root:setLight(blockLight, skyLight)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[PlayerAPI#PlayerAPI:getPos|player:getPos]] [[WorldAPI#WorldAPI.getBlockLightLevel|world.getBlockLightLevel]] [[WorldAPI#WorldAPI.getSkyLightLevel|world.getSkyLightLevel]]&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getLight ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setLight&amp;lt;/code&amp;gt;. Returns &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getLight()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector2}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
&lt;br /&gt;
print(root:getLight()) --&amp;gt; nil&lt;br /&gt;
&lt;br /&gt;
root:setLight(12, 8)&lt;br /&gt;
&lt;br /&gt;
let light = root:getLight()&lt;br /&gt;
print(light) --&amp;gt; vec(12, 8)&lt;br /&gt;
print(&amp;quot;BlockLightLevel -&amp;gt; &amp;quot;, light.x) --&amp;gt; &amp;quot;BlockLightLevel -&amp;gt; 12&amp;quot;&lt;br /&gt;
print(&amp;quot;SkyLightLevel -&amp;gt; &amp;quot;, light.y) --&amp;gt; &amp;quot;BlockLightLevel -&amp;gt; 8&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setLight|setLight]]&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setOverlay ====&lt;br /&gt;
Overrides the values used for rendering the red damage tint and the white creeper fuse effect. Really only useful for preventing the damage overlay from rendering on stuff like armor.&lt;br /&gt;
&lt;br /&gt;
Valid values for whiteOverlay: 0-15&lt;br /&gt;
&lt;br /&gt;
Valid values for hurtOverlay: 0-7&lt;br /&gt;
&lt;br /&gt;
whiteOverlay is a gradually increasing white tint from 0 - 15&lt;br /&gt;
&lt;br /&gt;
hurtOverlay is an unchanging red tint from 0 - 7.&lt;br /&gt;
&lt;br /&gt;
When set, hurtOverlay overrides whiteOverlay. For whiteOverlay to not be overriden, hurtOverlay needs to be 8 or more.&lt;br /&gt;
&lt;br /&gt;
Providing &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; will undo the override, allowing Minecraft to control the overlay again.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOverlay(overlayVector {{type|Vector2}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOverlay(whiteOverlay {{type|integer}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}}, hurtOverlay {{type|integer}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Damage overlay&lt;br /&gt;
root:setOverlay(0, 0)&lt;br /&gt;
-- Literally no difference&lt;br /&gt;
root:setOverlay(0, 5)&lt;br /&gt;
root:setOverlay(0, 7)&lt;br /&gt;
&lt;br /&gt;
-- Doesnt work. Damage overlay overrides white&lt;br /&gt;
root:setOverlay(15, 0)&lt;br /&gt;
&lt;br /&gt;
-- This works. Max white overlay&lt;br /&gt;
root:setOverlay(15, 15)&lt;br /&gt;
&lt;br /&gt;
-- This can be used to for preventing the damage overlay on armor&lt;br /&gt;
root:setOverlay(0, 15)&lt;br /&gt;
&lt;br /&gt;
-- Give control back to Minecraft&lt;br /&gt;
root:setOverlay(nil)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getOverlay ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setOverlay&amp;lt;/code&amp;gt;. Returns &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOverlay()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector2}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
&lt;br /&gt;
print(root:getOverlay()) --&amp;gt; nil&lt;br /&gt;
&lt;br /&gt;
root:setOverlay(8, 15)&lt;br /&gt;
&lt;br /&gt;
let overlay = root:getOverlay()&lt;br /&gt;
print(overlay) --&amp;gt; vec(8, 15)&lt;br /&gt;
print(&amp;quot;whiteOverlay -&amp;gt; &amp;quot;, overlay.x) --&amp;gt; &amp;quot;whiteOverlay -&amp;gt; 8&amp;quot;&lt;br /&gt;
print(&amp;quot;hurtOverlay -&amp;gt; &amp;quot;, overlay.y) --&amp;gt; &amp;quot;hurtOverlay -&amp;gt; 15&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOverlay|setOverlay]]&lt;br /&gt;
&lt;br /&gt;
=== renderTasks ===&lt;br /&gt;
todo: put all rendertask functions in here &lt;br /&gt;
&lt;br /&gt;
=== Render Methods ===&lt;br /&gt;
todo: Put partToWorldMatrix, preRender, midRender, and PostRender in here&lt;br /&gt;
&lt;br /&gt;
=== Animation Methods ===&lt;br /&gt;
todo: put getAnimPos/Rot/Scale and overrideVanillaPos/Rot/Scale in here&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=310</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=310"/>
		<updated>2024-09-28T14:16:55Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: /* ModelPart:getChildren */ minor tweaks&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into a ModelPart.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
{{note|&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; itself is a ModelPart. This allows you to apply transformations to the entire model, using e.g. &amp;lt;code&amp;gt;models:setScale(0.5)&amp;lt;/code&amp;gt;.|tag=Trivia|color=#A155DA}}&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be indexed with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ModelPart ParentTypes ==&lt;br /&gt;
In Figura, a ParentType is applied to a ModelPart causing the ModelPart to behave in a predefined way. This behavior includes acting as a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, or parrots, and binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a case-sensitive ParentType.&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType which can cause unintended behavior!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[ModelParts#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart Properties ===&lt;br /&gt;
Read-only properties of a ModelPart&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getName&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getType&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their face data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Editing ModelPart Hierarchy ===&lt;br /&gt;
Methods relating to getting other ModelParts and manipulating the ModelPart tree&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getParent&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}} | {{type|nil}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getChildren&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns an array containing all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart|[]}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
printTable(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[Globals#printTable|printTable]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:isChildOf&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Recursively checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:copy&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setParentType|setParentType]], [[ModelParts#ModelPart:getParentType|getParentType]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children because it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getName|getName]], [[ModelParts#ModelPart:getChildren|getChildren]], [[ModelParts#ModelPart:addChild|addChild]], [[ModelParts#ModelPart:removeChild|removeChild]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:addChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:copy|copy]], [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:removeChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:remove&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes this ModelPart from the parent&#039;s child list. Returns self&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;remove()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:remove() -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
models.model.root.LeftLeg:addChild(head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:addChild|addChild]]&lt;br /&gt;
&lt;br /&gt;
=== Manipulation ===&lt;br /&gt;
Methods relating to manipulating the ModelPart within physical space&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setPos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the offset of the the position of the ModelPart. Position translation applies on the local rotation axis.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(pos {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Move 10 units on the local y axis&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getPos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,10,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the rotation of the ModelPart. Rotates the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Rotate 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setRot(0, 45, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;. Will be the Rotation values defined in BlockBench when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0) -- Most ModelParts will not have a rotation set in blockbench&lt;br /&gt;
head:setRot(45, 0, 0)&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setRot|setRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the scale of the ModelPart. Scales the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Squishes and stretches the entire model&lt;br /&gt;
models.model:setScale(1.5, 0.75, 1.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setScale|setScale]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the pivot point of the ModelPart. &#039;&#039;This overrides the pivot point defined in blockbench.&#039;&#039; It is recommended to use [[ModelParts#ModelPart:setOffsetPivot|setOffsetPivot]] instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- For a normal size humanoid model, the Head&#039;s pivot point is usually at 0,24,0&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setPivot(0, 28, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the Pivot Point defined in BlockBench, or the value set by &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; if it was already overwritten.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- The Head group&#039;s pivot point for a humanoid model is usually at 0,24,0&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,24,0)&lt;br /&gt;
head:setPivot(0,0,0)&lt;br /&gt;
-- We have completely ruined the rendering of this ModelPart&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setPivot|setPivot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a rotation value that will be added to the ModelPart&#039;s rotation.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- ModelParts inherit their rotation from blockbench. The Head usually has a rotation of 0,0,0 for consistency with the vanilla model&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
-- Set the offset to 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setOffsetRot(0, 45, 0)&lt;br /&gt;
-- The original rotation is unchanged.&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&lt;br /&gt;
-- setOffsetRot is not additive.&lt;br /&gt;
head:setOffsetRot(0, 25, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,25,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getRot|getRot]] [[ModelParts#ModelPart:getOffsetRot|getOffsetRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;. Will be 0,0,0 when the script begins&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetRot(45, 0, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetRot|setOffsetRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a scale value that will be multiplied with the ModelPart&#039;s scale.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Half the size of the head&lt;br /&gt;
head:setOffsetScale(0.5)&lt;br /&gt;
-- Results in no changes&lt;br /&gt;
-- I have no idea what this is used for&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setOffsetScale(2)&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetScale|setOffsetScale]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a value that will be added to the ModelPart&#039;s pivot point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube and offset the pivot up by 4,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setOffsetPivot(0, 4, 0)&lt;br /&gt;
-- Notice that we did not need to know the original pivot point to do this&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetPivot(0,4,0)&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,4,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetPivot|setOffsetPivot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setMatrix&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Allows you to manually define the matrix used for positioning this ModelPart. Returns self for method chaining.&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt; will undo &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;getPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;getOffsetPivot&amp;lt;/code&amp;gt; will return invalid values while &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt; is in effect. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;getTruePos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueScale&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;getTruePivot&amp;lt;/code&amp;gt; are probably also affected, but nobody tested them yet.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setMatrix(matrix {{type|Matrix4}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTruePos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the position after all calculations are done. This includes &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt; and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTrueRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the rotation after all calculations are done. This includes &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTrueScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the scale after all calculations are done. This includes &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTrueScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTruePivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the pivot point after all calculations are done. This includes &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visual Manipulation ===&lt;br /&gt;
Methods relating to modifying how a ModelPart looks&lt;br /&gt;
&lt;br /&gt;
todo: put anything related to renderType, textures, and other visual modifications in here&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setVisible ====&lt;br /&gt;
Sets if this ModelPart is visible or not. Children of this ModelPart will also be invisible while this part is invisible.&lt;br /&gt;
&lt;br /&gt;
A value of &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; is interpreted as &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; on 0.1.4 and below, and &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; on 0.1.5 and above. This message will disappear &amp;lt;s&amp;gt;if&amp;lt;/s&amp;gt; when 0.1.6 is released.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setVisible(visible {{type|boolean}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
head:setVisible(false) -- Bye bye Head!&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getVisible ====&lt;br /&gt;
Recursively goes up the ModelPart tree until it finds a ModelPart that is invisible, or the ModelPart is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other words, if a parent part is invisible, this function returns &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;. If all parent parts are visible, this function will return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Kinda stupid. This is fixed in 0.1.5 to never return &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}} {{until|0.1.5}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool}} {{since|0.1.5}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; nil --&amp;lt; this is stupid&lt;br /&gt;
root:setVisible(false) -- Bye bye root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; false&lt;br /&gt;
root:setVisible(true) -- Welcome back root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; true --&amp;lt; aaaaaaaa&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setColor ====&lt;br /&gt;
Sets a value to multiply with all pixels on the ModelPart&#039;s texture. Children of this ModelPart inherit the color, multiplied with their own.&lt;br /&gt;
&lt;br /&gt;
1,1,1 multiplies all color channels by 1, resulting in the texture unchanged. 0,0,0 results in all channels being black.&lt;br /&gt;
&lt;br /&gt;
Expects values between 0 and 1. Numbers larger than 1 results in undocumented behaviour. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If only &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is defined as a number and both &amp;lt;code&amp;gt;g&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; are omitted, &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is used for all 3 color channels.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(color {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(colorAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(r {{type|number}}, g {{type|number}}, b {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Darken the entire model&lt;br /&gt;
root:setColor(0.5,0.5,0.5)&lt;br /&gt;
-- Tint the Head red by reducing the other color channels.&lt;br /&gt;
-- Color is inherited from parents, so the effective color is (0.5, 0.45, 0.45)&lt;br /&gt;
root.Head:setColor(1,0.7,0.7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- If you want to &#039;reset&#039; a child&#039;s color value, extra work is needed.&lt;br /&gt;
&lt;br /&gt;
-- Color is max red&lt;br /&gt;
local color = vec(1,0,0)&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- root has color&lt;br /&gt;
root:setColor(color)&lt;br /&gt;
-- Through magic and wizardry, this &#039;resets&#039; the color of Head back to white, dispite it&#039;s parent having a non-white color&lt;br /&gt;
root.Head:setColor(-color + 2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getColor ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setColor&amp;lt;/code&amp;gt;. Returns 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getColor()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
root:setColor(0.5)&lt;br /&gt;
print(root:getColor()) --&amp;gt; (0.5, 0.5, 0.5)&lt;br /&gt;
root.Head:setColor(1,0.7,0.7)&lt;br /&gt;
// getColor is not recursive&lt;br /&gt;
print(root.Head:getColor()) --&amp;gt; (1, 0.7, 0.7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setColor|setColor]]&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setOpacity ====&lt;br /&gt;
Sets the opacity of the ModelPart. Children of this ModelPart inherit the opacity, multiplied with their own.&lt;br /&gt;
&lt;br /&gt;
Minecraft has a minimum visible opacity of 0.1. Opacity values lower than 0.1 will not render at all. Needs verification.&lt;br /&gt;
&lt;br /&gt;
Only supported on [[RenderType|RenderTypes]] that support translucency. The default primary RenderType is &amp;lt;code&amp;gt;TRANSLUCENT&amp;lt;/code&amp;gt;, so most don&#039;t have to worry about it.&lt;br /&gt;
&lt;br /&gt;
Expects a value between 0 and 1.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOpacity(opacity {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Half opacity&lt;br /&gt;
root:setOpacity(0.5)&lt;br /&gt;
-- Half of half opacity&lt;br /&gt;
root.Head:setColor(0.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getOpacity ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setOpacity&amp;lt;/code&amp;gt;. Returns 1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOpacity()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|number}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
root:setOpacity(0.5)&lt;br /&gt;
print(root:getOpacity()) --&amp;gt; 0.5&lt;br /&gt;
root.Head:setOpacity(0.5)&lt;br /&gt;
// getOpacity is not recursive&lt;br /&gt;
print(root.Head:getOpacity()) --&amp;gt; 0.5&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOpacity|setOpacity]]&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setLight ====&lt;br /&gt;
Overrides the lightlevels used to render the ModelPart. Children of this ModelPart inherit the lightlevel.&lt;br /&gt;
&lt;br /&gt;
Expects 2 values between 0 and 15, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Providing &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; will undo the override, allowing Minecraft to control the lightlevel again.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setLight(light {{type|Vector2}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setLight(blockLight {{type|integer}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}}, skyLight {{type|integer}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Max light&lt;br /&gt;
root:setLight(15, 15)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- set light based on position (This is a fix for broken lighting on World parts)&lt;br /&gt;
function events.tick()&lt;br /&gt;
  local pos = player:getPos()&lt;br /&gt;
  local blockLight = world.getBlockLightLevel(pos)&lt;br /&gt;
  local skyLight = world.getSkyLightLevel(pos)&lt;br /&gt;
  root:setLight(blockLight, skyLight)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[PlayerAPI#PlayerAPI:getPos|player:getPos]] [[WorldAPI#WorldAPI.getBlockLightLevel|world.getBlockLightLevel]] [[WorldAPI#WorldAPI.getSkyLightLevel|world.getSkyLightLevel]]&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getLight ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setLight&amp;lt;/code&amp;gt;. Returns &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getLight()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector2}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
&lt;br /&gt;
print(root:getLight()) --&amp;gt; nil&lt;br /&gt;
&lt;br /&gt;
root:setLight(12, 8)&lt;br /&gt;
&lt;br /&gt;
let light = root:getLight()&lt;br /&gt;
print(light) --&amp;gt; vec(12, 8)&lt;br /&gt;
print(&amp;quot;BlockLightLevel -&amp;gt; &amp;quot;, light.x) --&amp;gt; &amp;quot;BlockLightLevel -&amp;gt; 12&amp;quot;&lt;br /&gt;
print(&amp;quot;SkyLightLevel -&amp;gt; &amp;quot;, light.y) --&amp;gt; &amp;quot;BlockLightLevel -&amp;gt; 8&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setLight|setLight]]&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setOverlay ====&lt;br /&gt;
Overrides the values used for rendering the red damage tint and the white creeper fuse effect. Really only useful for preventing the damage overlay from rendering on stuff like armor.&lt;br /&gt;
&lt;br /&gt;
Valid values for whiteOverlay: 0-15&lt;br /&gt;
&lt;br /&gt;
Valid values for hurtOverlay: 0-7&lt;br /&gt;
&lt;br /&gt;
whiteOverlay is a gradually increasing white tint from 0 - 15&lt;br /&gt;
&lt;br /&gt;
hurtOverlay is an unchanging red tint from 0 - 7.&lt;br /&gt;
&lt;br /&gt;
When set, hurtOverlay overrides whiteOverlay. For whiteOverlay to not be overriden, hurtOverlay needs to be 8 or more.&lt;br /&gt;
&lt;br /&gt;
Providing &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; will undo the override, allowing Minecraft to control the overlay again.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOverlay(overlayVector {{type|Vector2}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOverlay(whiteOverlay {{type|integer}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}}, hurtOverlay {{type|integer}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Damage overlay&lt;br /&gt;
root:setOverlay(0, 0)&lt;br /&gt;
-- Literally no difference&lt;br /&gt;
root:setOverlay(0, 5)&lt;br /&gt;
root:setOverlay(0, 7)&lt;br /&gt;
&lt;br /&gt;
-- Doesnt work. Damage overlay overrides white&lt;br /&gt;
root:setOverlay(15, 0)&lt;br /&gt;
&lt;br /&gt;
-- This works. Max white overlay&lt;br /&gt;
root:setOverlay(15, 15)&lt;br /&gt;
&lt;br /&gt;
-- This can be used to for preventing the damage overlay on armor&lt;br /&gt;
root:setOverlay(0, 15)&lt;br /&gt;
&lt;br /&gt;
-- Give control back to Minecraft&lt;br /&gt;
root:setOverlay(nil)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getOverlay ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setOverlay&amp;lt;/code&amp;gt;. Returns &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOverlay()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector2}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
&lt;br /&gt;
print(root:getOverlay()) --&amp;gt; nil&lt;br /&gt;
&lt;br /&gt;
root:setOverlay(8, 15)&lt;br /&gt;
&lt;br /&gt;
let overlay = root:getOverlay()&lt;br /&gt;
print(overlay) --&amp;gt; vec(8, 15)&lt;br /&gt;
print(&amp;quot;whiteOverlay -&amp;gt; &amp;quot;, overlay.x) --&amp;gt; &amp;quot;whiteOverlay -&amp;gt; 8&amp;quot;&lt;br /&gt;
print(&amp;quot;hurtOverlay -&amp;gt; &amp;quot;, overlay.y) --&amp;gt; &amp;quot;hurtOverlay -&amp;gt; 15&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOverlay|setOverlay]]&lt;br /&gt;
&lt;br /&gt;
=== renderTasks ===&lt;br /&gt;
todo: put all rendertask functions in here &lt;br /&gt;
&lt;br /&gt;
=== Render Methods ===&lt;br /&gt;
todo: Put partToWorldMatrix, preRender, midRender, and PostRender in here&lt;br /&gt;
&lt;br /&gt;
=== Animation Methods ===&lt;br /&gt;
todo: put getAnimPos/Rot/Scale and overrideVanillaPos/Rot/Scale in here&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=296</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=296"/>
		<updated>2024-09-28T00:43:02Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: /* Visual Manipulation */ setColor setLight setOpacity setOverlay &amp;amp; getters&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into a ModelPart.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
{{note|&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; itself is a ModelPart. This allows you to apply transformations to the entire model, using e.g. &amp;lt;code&amp;gt;models:setScale(0.5)&amp;lt;/code&amp;gt;.|tag=Trivia|color=#A155DA}}&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be indexed with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ModelPart ParentTypes ==&lt;br /&gt;
In Figura, a ParentType is applied to a ModelPart causing the ModelPart to behave in a predefined way. This behavior includes acting as a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, or parrots, and binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a case-sensitive ParentType.&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType which can cause unintended behavior!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[ModelParts#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart Properties ===&lt;br /&gt;
Read-only properties of a ModelPart&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getName&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getType&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their face data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Editing ModelPart Hierarchy ===&lt;br /&gt;
Methods relating to getting other ModelParts and manipulating the ModelPart tree&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getParent&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}} | {{type|nil}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getChildren&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns an array of all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart|[]}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
print(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:isChildOf&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Recursively checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:copy&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setParentType|setParentType]], [[ModelParts#ModelPart:getParentType|getParentType]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children because it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getName|getName]], [[ModelParts#ModelPart:getChildren|getChildren]], [[ModelParts#ModelPart:addChild|addChild]], [[ModelParts#ModelPart:removeChild|removeChild]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:addChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:copy|copy]], [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:removeChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:remove&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes this ModelPart from the parent&#039;s child list. Returns self&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;remove()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:remove() -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
models.model.root.LeftLeg:addChild(head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:addChild|addChild]]&lt;br /&gt;
&lt;br /&gt;
=== Manipulation ===&lt;br /&gt;
Methods relating to manipulating the ModelPart within physical space&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setPos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the offset of the the position of the ModelPart. Position translation applies on the local rotation axis.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(pos {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Move 10 units on the local y axis&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getPos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,10,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the rotation of the ModelPart. Rotates the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Rotate 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setRot(0, 45, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;. Will be the Rotation values defined in BlockBench when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0) -- Most ModelParts will not have a rotation set in blockbench&lt;br /&gt;
head:setRot(45, 0, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setRot|setRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the scale of the ModelPart. Scales the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Squishes and stretches the entire model&lt;br /&gt;
models.model:setScale(1.5, 0.75, 1.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setScale|setScale]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the pivot point of the ModelPart. &#039;&#039;This overrides the pivot point defined in blockbench.&#039;&#039; It is recommended to use [[ModelParts#ModelPart:setOffsetPivot|setOffsetPivot]] instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- For a normal size humanoid model, the Head&#039;s pivot point is usually at 0,24,0&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setPivot(0, 28, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the Pivot Point defined in BlockBench, or the value set by &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; if it was already overwritten.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- The Head group&#039;s pivot point for a humanoid model is usually at 0,24,0&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,24,0)&lt;br /&gt;
head:setPivot(0,0,0)&lt;br /&gt;
-- We have completely ruined the rendering of this ModelPart&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setPivot|setPivot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a rotation value that will be added to the ModelPart&#039;s rotation.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- ModelParts inherit their rotation from blockbench. The Head usually has a rotation of 0,0,0 for consistency with the vanilla model&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
-- Set the offset to 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setOffsetRot(0, 45, 0)&lt;br /&gt;
-- The original rotation is unchanged.&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&lt;br /&gt;
-- setOffsetRot is not additive.&lt;br /&gt;
head:setOffsetRot(0, 25, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,25,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getRot|getRot]] [[ModelParts#ModelPart:getOffsetRot|getOffsetRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;. Will be 0,0,0 when the script begins&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetRot(45, 0, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetRot|setOffsetRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a scale value that will be multiplied with the ModelPart&#039;s scale.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Half the size of the head&lt;br /&gt;
head:setOffsetScale(0.5)&lt;br /&gt;
-- Results in no changes&lt;br /&gt;
-- I have no idea what this is used for&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setOffsetScale(2)&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetScale|setOffsetScale]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a value that will be added to the ModelPart&#039;s pivot point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube and offset the pivot up by 4,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setOffsetPivot(0, 4, 0)&lt;br /&gt;
-- Notice that we did not need to know the original pivot point to do this&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetPivot(0,4,0)&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,4,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetPivot|setOffsetPivot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setMatrix&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Allows you to manually define the matrix used for positioning this ModelPart. Returns self for method chaining.&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt; will undo &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;getPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;getOffsetPivot&amp;lt;/code&amp;gt; will return invalid values while &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt; is in effect. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;getTruePos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueScale&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;getTruePivot&amp;lt;/code&amp;gt; are probably also affected, but nobody tested them yet.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setMatrix(matrix {{type|Matrix4}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTruePos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the position after all calculations are done. This includes &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt; and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTrueRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the rotation after all calculations are done. This includes &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTrueScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the scale after all calculations are done. This includes &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTrueScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTruePivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the pivot point after all calculations are done. This includes &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visual Manipulation ===&lt;br /&gt;
Methods relating to modifying how a ModelPart looks&lt;br /&gt;
&lt;br /&gt;
todo: put anything related to renderType, textures, and other visual modifications in here&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setVisible ====&lt;br /&gt;
Sets if this ModelPart is visible or not. Children of this ModelPart will also be invisible while this part is invisible.&lt;br /&gt;
&lt;br /&gt;
A value of &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; is interpreted as &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; on 0.1.4 and below, and &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; on 0.1.5 and above. This message will disappear &amp;lt;s&amp;gt;if&amp;lt;/s&amp;gt; when 0.1.6 is released.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setVisible(visible {{type|boolean}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
head:setVisible(false) -- Bye bye Head!&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getVisible ====&lt;br /&gt;
Recursively goes up the ModelPart tree until it finds a ModelPart that is invisible, or the ModelPart is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other words, if a parent part is invisible, this function returns &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;. If all parent parts are visible, this function will return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Kinda stupid. This is fixed in 0.1.5 to never return &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}} {{until|0.1.5}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool}} {{since|0.1.5}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; nil --&amp;lt; this is stupid&lt;br /&gt;
root:setVisible(false) -- Bye bye root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; false&lt;br /&gt;
root:setVisible(true) -- Welcome back root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; true --&amp;lt; aaaaaaaa&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setColor ====&lt;br /&gt;
Sets a value to multiply with all pixels on the ModelPart&#039;s texture. Children of this ModelPart inherit the color, multiplied with their own.&lt;br /&gt;
&lt;br /&gt;
1,1,1 multiplies all color channels by 1, resulting in the texture unchanged. 0,0,0 results in all channels being black.&lt;br /&gt;
&lt;br /&gt;
Expects values between 0 and 1. Numbers larger than 1 results in undocumented behaviour. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If only &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is defined as a number and both &amp;lt;code&amp;gt;g&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; are omitted, &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; is used for all 3 color channels.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(color {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(colorAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setColor(r {{type|number}}, g {{type|number}}, b {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Darken the entire model&lt;br /&gt;
root:setColor(0.5,0.5,0.5)&lt;br /&gt;
-- Tint the Head red by reducing the other color channels.&lt;br /&gt;
-- Color is inherited from parents, so the effective color is (0.5, 0.45, 0.45)&lt;br /&gt;
root.Head:setColor(1,0.7,0.7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- If you want to &#039;reset&#039; a child&#039;s color value, extra work is needed.&lt;br /&gt;
&lt;br /&gt;
-- Color is max red&lt;br /&gt;
local color = vec(1,0,0)&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- root has color&lt;br /&gt;
root:setColor(color)&lt;br /&gt;
-- Through magic and wizardry, this &#039;resets&#039; the color of Head back to white, dispite it&#039;s parent having a non-white color&lt;br /&gt;
root.Head:setColor(-color + 2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getColor ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setColor&amp;lt;/code&amp;gt;. Returns 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getColor()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
root:setColor(0.5)&lt;br /&gt;
print(root:getColor()) --&amp;gt; (0.5, 0.5, 0.5)&lt;br /&gt;
root.Head:setColor(1,0.7,0.7)&lt;br /&gt;
// getColor is not recursive&lt;br /&gt;
print(root.Head:getColor()) --&amp;gt; (1, 0.7, 0.7)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setColor|setColor]]&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setOpacity ====&lt;br /&gt;
Sets the opacity of the ModelPart. Children of this ModelPart inherit the opacity, multiplied with their own.&lt;br /&gt;
&lt;br /&gt;
Minecraft has a minimum visible opacity of 0.1. Opacity values lower than 0.1 will not render at all. Needs verification.&lt;br /&gt;
&lt;br /&gt;
Only supported on [[RenderType|RenderTypes]] that support translucency. The default primary RenderType is &amp;lt;code&amp;gt;TRANSLUCENT&amp;lt;/code&amp;gt;, so most don&#039;t have to worry about it.&lt;br /&gt;
&lt;br /&gt;
Expects a value between 0 and 1.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOpacity(opacity {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Half opacity&lt;br /&gt;
root:setOpacity(0.5)&lt;br /&gt;
-- Half of half opacity&lt;br /&gt;
root.Head:setColor(0.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getOpacity ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setOpacity&amp;lt;/code&amp;gt;. Returns 1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOpacity()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|number}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
root:setOpacity(0.5)&lt;br /&gt;
print(root:getOpacity()) --&amp;gt; 0.5&lt;br /&gt;
root.Head:setOpacity(0.5)&lt;br /&gt;
// getOpacity is not recursive&lt;br /&gt;
print(root.Head:getOpacity()) --&amp;gt; 0.5&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOpacity|setOpacity]]&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setLight ====&lt;br /&gt;
Overrides the lightlevels used to render the ModelPart. Children of this ModelPart inherit the lightlevel.&lt;br /&gt;
&lt;br /&gt;
Expects 2 values between 0 and 15, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Providing &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; will undo the override, allowing Minecraft to control the lightlevel again.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setLight(light {{type|Vector2}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setLight(blockLight {{type|integer}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}}, skyLight {{type|integer}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Max light&lt;br /&gt;
root:setLight(15, 15)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- set light based on position (This is a fix for broken lighting on World parts)&lt;br /&gt;
function events.tick()&lt;br /&gt;
  local pos = player:getPos()&lt;br /&gt;
  local blockLight = world.getBlockLightLevel(pos)&lt;br /&gt;
  local skyLight = world.getSkyLightLevel(pos)&lt;br /&gt;
  root:setLight(blockLight, skyLight)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[PlayerAPI#PlayerAPI:getPos|player:getPos]] [[WorldAPI#WorldAPI.getBlockLightLevel|world.getBlockLightLevel]] [[WorldAPI#WorldAPI.getSkyLightLevel|world.getSkyLightLevel]]&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getLight ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setLight&amp;lt;/code&amp;gt;. Returns &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getLight()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector2}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
&lt;br /&gt;
print(root:getLight()) --&amp;gt; nil&lt;br /&gt;
&lt;br /&gt;
root:setLight(12, 8)&lt;br /&gt;
&lt;br /&gt;
let light = root:getLight()&lt;br /&gt;
print(light) --&amp;gt; vec(12, 8)&lt;br /&gt;
print(&amp;quot;BlockLightLevel -&amp;gt; &amp;quot;, light.x) --&amp;gt; &amp;quot;BlockLightLevel -&amp;gt; 12&amp;quot;&lt;br /&gt;
print(&amp;quot;SkyLightLevel -&amp;gt; &amp;quot;, light.y) --&amp;gt; &amp;quot;BlockLightLevel -&amp;gt; 8&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setLight|setLight]]&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setOverlay ====&lt;br /&gt;
Overrides the values used for rendering the red damage tint and the white creeper fuse effect. Really only useful for preventing the damage overlay from rendering on stuff like armor.&lt;br /&gt;
&lt;br /&gt;
Valid values for whiteOverlay: 0-15&lt;br /&gt;
&lt;br /&gt;
Valid values for hurtOverlay: 0-7&lt;br /&gt;
&lt;br /&gt;
whiteOverlay is a gradually increasing white tint from 0 - 15&lt;br /&gt;
&lt;br /&gt;
hurtOverlay is an unchanging red tint from 0 - 7.&lt;br /&gt;
&lt;br /&gt;
When set, hurtOverlay overrides whiteOverlay. For whiteOverlay to not be overriden, hurtOverlay needs to be 8 or more.&lt;br /&gt;
&lt;br /&gt;
Providing &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; will undo the override, allowing Minecraft to control the overlay again.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOverlay(overlayVector {{type|Vector2}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOverlay(whiteOverlay {{type|integer}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}}, hurtOverlay {{type|integer}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
-- Damage overlay&lt;br /&gt;
root:setOverlay(0, 0)&lt;br /&gt;
-- Literally no difference&lt;br /&gt;
root:setOverlay(0, 5)&lt;br /&gt;
root:setOverlay(0, 7)&lt;br /&gt;
&lt;br /&gt;
-- Doesnt work. Damage overlay overrides white&lt;br /&gt;
root:setOverlay(15, 0)&lt;br /&gt;
&lt;br /&gt;
-- This works. Max white overlay&lt;br /&gt;
root:setOverlay(15, 15)&lt;br /&gt;
&lt;br /&gt;
-- This can be used to for preventing the damage overlay on armor&lt;br /&gt;
root:setOverlay(0, 15)&lt;br /&gt;
&lt;br /&gt;
-- Give control back to Minecraft&lt;br /&gt;
root:setOverlay(nil)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getOverlay ====&lt;br /&gt;
Gets the value set by &amp;lt;code&amp;gt;setOverlay&amp;lt;/code&amp;gt;. Returns &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOverlay()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector2}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
&lt;br /&gt;
print(root:getOverlay()) --&amp;gt; nil&lt;br /&gt;
&lt;br /&gt;
root:setOverlay(8, 15)&lt;br /&gt;
&lt;br /&gt;
let overlay = root:getOverlay()&lt;br /&gt;
print(overlay) --&amp;gt; vec(8, 15)&lt;br /&gt;
print(&amp;quot;whiteOverlay -&amp;gt; &amp;quot;, overlay.x) --&amp;gt; &amp;quot;whiteOverlay -&amp;gt; 8&amp;quot;&lt;br /&gt;
print(&amp;quot;hurtOverlay -&amp;gt; &amp;quot;, overlay.y) --&amp;gt; &amp;quot;hurtOverlay -&amp;gt; 15&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOverlay|setOverlay]]&lt;br /&gt;
&lt;br /&gt;
=== renderTasks ===&lt;br /&gt;
todo: put all rendertask functions in here &lt;br /&gt;
&lt;br /&gt;
=== Render Methods ===&lt;br /&gt;
todo: Put partToWorldMatrix, preRender, midRender, and PostRender in here&lt;br /&gt;
&lt;br /&gt;
=== Animation Methods ===&lt;br /&gt;
todo: put getAnimPos/Rot/Scale and overrideVanillaPos/Rot/Scale in here&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=217</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=217"/>
		<updated>2024-09-27T02:13:37Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: grammer&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar, and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into a ModelPart.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Fun Fact: models itself is a ModelPart&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be index with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ModelPart ParentTypes ==&lt;br /&gt;
In Figura, a ParentType is applied to a ModelPart causing the ModelPart to behave in a predefined behaviour. This behaviour includes behaving like a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, and parrots, or binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself, or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a ParentType&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType and can cause unintended behaviour!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[ModelParts#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart Properties ===&lt;br /&gt;
Read-only properties of a ModelPart&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getName&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getType&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their face data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Child Manipulation ===&lt;br /&gt;
Methods relating to getting other ModelParts and manipulating the ModelPart tree&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getParent&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}} | {{type|nil}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getChildren&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns an array of all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart|[]}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
print(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:isChildOf&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Recursivly checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:copy&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setParentType|setParentType]], [[ModelParts#ModelPart:getParentType|getParentType]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children cause it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getName|getName]], [[ModelParts#ModelPart:getChildren|getChildren]], [[ModelParts#ModelPart:addChild|addChild]], [[ModelParts#ModelPart:removeChild|removeChild]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:addChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:copy|copy]], [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:removeChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:remove&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes this ModelPart from the parent&#039;s child list. Returns self&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;remove()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:remove() -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
models.model.root.LeftLeg:addChild(head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:addChild|addChild]]&lt;br /&gt;
&lt;br /&gt;
=== Manipulation ===&lt;br /&gt;
Methods relating to manipulating the ModelPart within physical space&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setPos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the offset of the the position of the ModelPart. Position translation applies on the local rotation axis.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(pos {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Move 10 units on the local y axis&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getPos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,10,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the rotation of the ModelPart. Rotates the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Rotate 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setRot(0, 45, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;. Will be the Rotation values defined in BlockBench when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0) -- Most ModelParts will not have a rotation set in blockbench&lt;br /&gt;
head:setRot(45, 0, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setRot|setRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the scale of the ModelPart. Scales the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Squishes and stretches the entire model&lt;br /&gt;
models.model:setScale(1.5, 0.75, 1.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setScale|setScale]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the pivot point of the ModelPart. &#039;&#039;This overrides the pivot point defined in blockbench.&#039;&#039; It is recommended to use [[ModelParts#ModelPart:setOffsetPivot|setOffsetPivot]] instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- For a normal size humanoid model, the Head&#039;s pivot point is usually at 0,24,0&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setPivot(0, 28, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the Pivot Point defined in BlockBench, or the value set by &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; if it was already overwritten.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- The Head group&#039;s pivot point for a humanoid model is usually at 0,24,0&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,24,0)&lt;br /&gt;
head:setPivot(0,0,0)&lt;br /&gt;
-- We have completely ruined the rendering of this ModelPart&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setPivot|setPivot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a rotation value that will be added to the ModelPart&#039;s rotation.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- ModelParts inherit their rotation from blockbench. The Head usually has a rotation of 0,0,0 for consistency with the vanilla model&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
-- Set the offset to 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setOffsetRot(0, 45, 0)&lt;br /&gt;
-- The original rotation is unchanged.&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&lt;br /&gt;
-- setOffsetRot is not additive.&lt;br /&gt;
head:setOffsetRot(0, 25, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,25,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getRot|getRot]] [[ModelParts#ModelPart:getOffsetRot|getOffsetRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;. Will be 0,0,0 when the script begins&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetRot(45, 0, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetRot|setOffsetRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a scale value that will be multiplied with the ModelPart&#039;s scale.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Half the size of the head&lt;br /&gt;
head:setOffsetScale(0.5)&lt;br /&gt;
-- Results in no changes&lt;br /&gt;
-- I have no idea what this is used for&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setOffsetScale(2)&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetScale|setOffsetScale]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a value that will be added to the ModelPart&#039;s pivot point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube and offset the pivot up by 4,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setOffsetPivot(0, 4, 0)&lt;br /&gt;
-- Notice that we did not need to know the original pivot point to do this&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetPivot(0,4,0)&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,4,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetPivot|setOffsetPivot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setMatrix&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Allows you to manually define the matrix used for positioning this ModelPart. Returns self for method chaining.&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt; will undo &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;getPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;getOffsetPivot&amp;lt;/code&amp;gt; will return invalid values while &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt; is in effect. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;getTruePos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueScale&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;getTruePivot&amp;lt;/code&amp;gt; are probably also affected, but nobody tested them yet.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setMatrix(matrix {{type|Matrix4}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTruePos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the position after all calculations are done. This includes &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt; and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTrueRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the rotation after all calculations are done. This includes &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTrueScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the scale after all calculations are done. This includes &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTrueScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTruePivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the pivot point after all calculations are done. This includes &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visual Manipulation ===&lt;br /&gt;
Methods relating to modifying how a ModelPart looks&lt;br /&gt;
&lt;br /&gt;
todo: put anything related to renderType, textures, and other visual modifications in here&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setVisible ====&lt;br /&gt;
Sets if this ModelPart is visible or not. Children of this ModelPart will also be invisible while this part is invisible.&lt;br /&gt;
&lt;br /&gt;
A value of &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; is interpreted as &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; on 0.1.4 and below, and &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; on 0.1.5 and above. This message will disappear &amp;lt;s&amp;gt;if&amp;lt;/s&amp;gt; when 0.1.6 is released.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setVisible(visible {{type|boolean}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
head:setVisible(false) -- Bye bye Head!&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getVisible ====&lt;br /&gt;
Recursivly goes up the ModelPart tree until it finds a ModelPart that is invisible, or the ModelPart is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other words, if a parent part is invisible, this function returns &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;. If all parent parts are visible, this function will return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Kinda stupid. This is fixed in 0.1.5 to never return &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool}} &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; {{type|nil}} {{until|0.1.5}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool}} {{since|0.1.5}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; nil --&amp;lt; this is stupid&lt;br /&gt;
root:setVisible(false) -- Bye bye root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; false&lt;br /&gt;
root:setVisible(true) -- Welcome back root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; true --&amp;lt; aaaaaaaa&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setColor ====&lt;br /&gt;
Sets a value to multiply with all pixels on the ModelPart&#039;s texture.&lt;br /&gt;
&lt;br /&gt;
=== renderTasks ===&lt;br /&gt;
todo: put all rendertask functions in here &lt;br /&gt;
&lt;br /&gt;
=== Render Methods ===&lt;br /&gt;
todo: Put partToWorldMatrix, preRender, midRender, and PostRender in here&lt;br /&gt;
&lt;br /&gt;
=== Animation Methods ===&lt;br /&gt;
todo: put getAnimPos/Rot/Scale and overrideVanillaPos/Rot/Scale in here&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=User:KitCat962&amp;diff=205</id>
		<title>User:KitCat962</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=User:KitCat962&amp;diff=205"/>
		<updated>2024-09-27T01:46:02Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: Undo revision 203 by KitCat962 (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Kitcat avatar shades.png|thumb|199x199px]]&lt;br /&gt;
hehehe&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=User:KitCat962&amp;diff=203</id>
		<title>User:KitCat962</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=User:KitCat962&amp;diff=203"/>
		<updated>2024-09-27T01:45:29Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: heading testing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Kitcat avatar shades.png|thumb|199x199px]]&lt;br /&gt;
hehehe&lt;br /&gt;
&lt;br /&gt;
= HEADING =&lt;br /&gt;
&lt;br /&gt;
== Heading ==&lt;br /&gt;
&lt;br /&gt;
=== Heading ===&lt;br /&gt;
&lt;br /&gt;
==== heading ====&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=196</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=196"/>
		<updated>2024-09-27T01:32:58Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: /* ModelPart Methods */ new categories&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to do achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar, and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into ModelParts.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Fun Fact: models itself is a ModelPart&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be index with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ModelPart ParentTypes ==&lt;br /&gt;
In Figura, a ParentType is applied to a ModelPart causing the ModelPart to behave in a predefined behaviour. This behaviour includes behaving like a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, and parrots, or binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself, or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a ParentType&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType and can cause unintended behaviour!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[ModelParts#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart Properties ===&lt;br /&gt;
Read-only properties of a ModelPart&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getName&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getType&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their face data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Child Manipulation ===&lt;br /&gt;
Methods relating to getting other ModelParts and manipulating the ModelPart tree&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getParent&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}} | {{type|nil}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getChildren&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns an array of all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart|[]}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
print(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:isChildOf&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Recursivly checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:copy&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setParentType|setParentType]], [[ModelParts#ModelPart:getParentType|getParentType]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children cause it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getName|getName]], [[ModelParts#ModelPart:getChildren|getChildren]], [[ModelParts#ModelPart:addChild|addChild]], [[ModelParts#ModelPart:removeChild|removeChild]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:addChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:copy|copy]], [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:removeChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:remove&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes this ModelPart from the parent&#039;s child list. Returns self&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;remove()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:remove() -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
models.model.root.LeftLeg:addChild(head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:addChild|addChild]]&lt;br /&gt;
&lt;br /&gt;
=== Manipulation ===&lt;br /&gt;
Methods relating to manipulating the ModelPart within physical space&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setPos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the offset of the the position of the ModelPart. Position translation applies on the local rotation axis.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(pos {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Move 10 units on the local y axis&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getPos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,10,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the rotation of the ModelPart. Rotates the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Rotate 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setRot(0, 45, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;. Will be the Rotation values defined in BlockBench when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0) -- Most ModelParts will not have a rotation set in blockbench&lt;br /&gt;
head:setRot(45, 0, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setRot|setRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the scale of the ModelPart. Scales the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Squishes and stretches the entire model&lt;br /&gt;
models.model:setScale(1.5, 0.75, 1.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setScale|setScale]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the pivot point of the ModelPart. &#039;&#039;This overrides the pivot point defined in blockbench.&#039;&#039; It is recommended to use [[ModelParts#ModelPart:setOffsetPivot|setOffsetPivot]] instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- For a normal size humanoid model, the Head&#039;s pivot point is usually at 0,24,0&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setPivot(0, 28, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the Pivot Point defined in BlockBench, or the value set by &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; if it was already overwritten.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- The Head group&#039;s pivot point for a humanoid model is usually at 0,24,0&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,24,0)&lt;br /&gt;
head:setPivot(0,0,0)&lt;br /&gt;
-- We have completely ruined the rendering of this ModelPart&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setPivot|setPivot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a rotation value that will be added to the ModelPart&#039;s rotation.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- ModelParts inherit their rotation from blockbench. The Head usually has a rotation of 0,0,0 for consistency with the vanilla model&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
-- Set the offset to 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setOffsetRot(0, 45, 0)&lt;br /&gt;
-- The original rotation is unchanged.&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&lt;br /&gt;
-- setOffsetRot is not additive.&lt;br /&gt;
head:setOffsetRot(0, 25, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,25,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getRot|getRot]] [[ModelParts#ModelPart:getOffsetRot|getOffsetRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;. Will be 0,0,0 when the script begins&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetRot(45, 0, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetRot|setOffsetRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a scale value that will be multiplied with the ModelPart&#039;s scale.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Half the size of the head&lt;br /&gt;
head:setOffsetScale(0.5)&lt;br /&gt;
-- Results in no changes&lt;br /&gt;
-- I have no idea what this is used for&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setOffsetScale(2)&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetScale|setOffsetScale]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a value that will be added to the ModelPart&#039;s pivot point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube and offset the pivot up by 4,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setOffsetPivot(0, 4, 0)&lt;br /&gt;
-- Notice that we did not need to know the original pivot point to do this&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetPivot(0,4,0)&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,4,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetPivot|setOffsetPivot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setMatrix&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Allows you to manually define the matrix used for positioning this ModelPart. Returns self for method chaining.&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt; will undo &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;getPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;getOffsetPivot&amp;lt;/code&amp;gt; will return invalid values while &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt; is in effect. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;getTruePos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueScale&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;getTruePivot&amp;lt;/code&amp;gt; are probably also affected, but nobody tested them yet.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setMatrix(matrix {{type|Matrix4}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTruePos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the position after all calculations are done. This includes &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt; and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTrueRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the rotation after all calculations are done. This includes &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTrueScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the scale after all calculations are done. This includes &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTrueScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTruePivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the pivot point after all calculations are done. This includes &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Visual Manipulation ===&lt;br /&gt;
Methods relating to modifying how a ModelPart looks&lt;br /&gt;
&lt;br /&gt;
todo: put anything related to renderType, textures, and other visual modifications in here&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setVisible ====&lt;br /&gt;
Sets if this ModelPart is visible or not. Children of this ModelPart will also be invisible while this part is invisible.&lt;br /&gt;
&lt;br /&gt;
A value of &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; is interpreted as &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; on 0.1.4 and below, and &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; on 0.1.5 and above. This message will disappear &amp;lt;s&amp;gt;if&amp;lt;/s&amp;gt; when 0.1.6 is released.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setVisible(visible {{type|boolean}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
head:setVisible(false) -- Bye bye Head!&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:getVisible ====&lt;br /&gt;
Recursivly goes up the ModelPart tree until it finds a ModelPart that is invisible, or the ModelPart is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other words, if a parent part is invisible, this function returns &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;. If all parent parts are visible, this function will return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. Kinda stupid. This is fixed in 0.1.5 to never return &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getVisible()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|bool}} | {{type|nil}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; nil --&amp;lt; this is stupid&lt;br /&gt;
root:setVisible(false) -- Bye bye root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; false&lt;br /&gt;
root:setVisible(true) -- Welcome back root!&lt;br /&gt;
print(root.Head:getVisible()) --&amp;gt; true --&amp;lt; aaaaaaaa&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ModelPart:setColor ====&lt;br /&gt;
Sets a value to multiply with all pixels on the ModelPart&#039;s texture.&lt;br /&gt;
&lt;br /&gt;
=== renderTasks ===&lt;br /&gt;
todo: put all rendertask functions in here &lt;br /&gt;
&lt;br /&gt;
=== Render Methods ===&lt;br /&gt;
todo: Put partToWorldMatrix, preRender, midRender, and PostRender in here&lt;br /&gt;
&lt;br /&gt;
=== Animation Methods ===&lt;br /&gt;
todo: put getAnimPos/Rot/Scale and overrideVanillaPos/Rot/Scale in here&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=191</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=191"/>
		<updated>2024-09-27T00:48:24Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: Redundant heading&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to do achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar, and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into ModelParts.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Fun Fact: models itself is a ModelPart&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be index with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ModelPart ParentTypes ==&lt;br /&gt;
In Figura, a ParentType is applied to a ModelPart causing the ModelPart to behave in a predefined behaviour. This behaviour includes behaving like a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, and parrots, or binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself, or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a ParentType&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType and can cause unintended behaviour!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[ModelParts#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart Properties ===&lt;br /&gt;
Read-only properties of a ModelPart&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getName&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getType&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their face data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Child Manipulation ===&lt;br /&gt;
Methods relating to getting other ModelParts and manipulating the ModelPart tree&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getParent&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}} | {{type|nil}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getChildren&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns an array of all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart|[]}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
print(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:isChildOf&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Recursivly checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:copy&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setParentType|setParentType]], [[ModelParts#ModelPart:getParentType|getParentType]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children cause it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getName|getName]], [[ModelParts#ModelPart:getChildren|getChildren]], [[ModelParts#ModelPart:addChild|addChild]], [[ModelParts#ModelPart:removeChild|removeChild]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:addChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:copy|copy]], [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:removeChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:remove&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes this ModelPart from the parent&#039;s child list. Returns self&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;remove()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:remove() -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
models.model.root.LeftLeg:addChild(head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:addChild|addChild]]&lt;br /&gt;
&lt;br /&gt;
=== Manipulation ===&lt;br /&gt;
Methods relating to manipulating the ModelPart within physical space&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setPos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the offset of the the position of the ModelPart. Position translation applies on the local rotation axis.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(pos {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Move 10 units on the local y axis&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getPos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,10,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the rotation of the ModelPart. Rotates the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Rotate 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setRot(0, 45, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;. Will be the Rotation values defined in BlockBench when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0) -- Most ModelParts will not have a rotation set in blockbench&lt;br /&gt;
head:setRot(45, 0, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setRot|setRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the scale of the ModelPart. Scales the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Squishes and stretches the entire model&lt;br /&gt;
models.model:setScale(1.5, 0.75, 1.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setScale|setScale]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the pivot point of the ModelPart. &#039;&#039;This overrides the pivot point defined in blockbench.&#039;&#039; It is recommended to use [[ModelParts#ModelPart:setOffsetPivot|setOffsetPivot]] instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- For a normal size humanoid model, the Head&#039;s pivot point is usually at 0,24,0&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setPivot(0, 28, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the Pivot Point defined in BlockBench, or the value set by &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; if it was already overwritten.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- The Head group&#039;s pivot point for a humanoid model is usually at 0,24,0&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,24,0)&lt;br /&gt;
head:setPivot(0,0,0)&lt;br /&gt;
-- We have completely ruined the rendering of this ModelPart&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setPivot|setPivot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a rotation value that will be added to the ModelPart&#039;s rotation.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- ModelParts inherit their rotation from blockbench. The Head usually has a rotation of 0,0,0 for consistency with the vanilla model&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
-- Set the offset to 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setOffsetRot(0, 45, 0)&lt;br /&gt;
-- The original rotation is unchanged.&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&lt;br /&gt;
-- setOffsetRot is not additive.&lt;br /&gt;
head:setOffsetRot(0, 25, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,25,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getRot|getRot]] [[ModelParts#ModelPart:getOffsetRot|getOffsetRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;. Will be 0,0,0 when the script begins&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetRot(45, 0, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetRot|setOffsetRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a scale value that will be multiplied with the ModelPart&#039;s scale.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Half the size of the head&lt;br /&gt;
head:setOffsetScale(0.5)&lt;br /&gt;
-- Results in no changes&lt;br /&gt;
-- I have no idea what this is used for&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setOffsetScale(2)&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetScale|setOffsetScale]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a value that will be added to the ModelPart&#039;s pivot point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube and offset the pivot up by 4,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setOffsetPivot(0, 4, 0)&lt;br /&gt;
-- Notice that we did not need to know the original pivot point to do this&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetPivot(0,4,0)&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,4,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetPivot|setOffsetPivot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setMatrix&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Allows you to manually define the matrix used for positioning this ModelPart. Returns self for method chaining.&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt; will undo &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;getPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;getOffsetPivot&amp;lt;/code&amp;gt; will return invalid values while &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt; is in effect. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;getTruePos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueScale&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;getTruePivot&amp;lt;/code&amp;gt; are probably also affected, but nobody tested them yet.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setMatrix(matrix {{type|Matrix4}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTruePos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the position after all calculations are done. This includes &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt; and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTrueRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the rotation after all calculations are done. This includes &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTrueScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the scale after all calculations are done. This includes &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTrueScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTruePivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the pivot point after all calculations are done. This includes &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=190</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=190"/>
		<updated>2024-09-27T00:47:10Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: Category descriptions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What are ModelParts ==&lt;br /&gt;
A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to do achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar, and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into ModelParts.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Fun Fact: models itself is a ModelPart&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be index with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ModelPart ParentTypes ==&lt;br /&gt;
In Figura, a ParentType is applied to a ModelPart causing the ModelPart to behave in a predefined behaviour. This behaviour includes behaving like a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, and parrots, or binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself, or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a ParentType&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType and can cause unintended behaviour!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[ModelParts#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart Properties ===&lt;br /&gt;
Read-only properties of a ModelPart&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getName&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getType&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their face data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Child Manipulation ===&lt;br /&gt;
Methods relating to getting other ModelParts and manipulating the ModelPart tree&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getParent&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}} | {{type|nil}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getChildren&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns an array of all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart|[]}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
print(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:isChildOf&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Recursivly checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:copy&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setParentType|setParentType]], [[ModelParts#ModelPart:getParentType|getParentType]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children cause it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getName|getName]], [[ModelParts#ModelPart:getChildren|getChildren]], [[ModelParts#ModelPart:addChild|addChild]], [[ModelParts#ModelPart:removeChild|removeChild]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:addChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:copy|copy]], [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:removeChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:remove&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes this ModelPart from the parent&#039;s child list. Returns self&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;remove()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:remove() -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
models.model.root.LeftLeg:addChild(head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:addChild|addChild]]&lt;br /&gt;
&lt;br /&gt;
=== Manipulation ===&lt;br /&gt;
Methods relating to manipulating the ModelPart within physical space&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setPos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the offset of the the position of the ModelPart. Position translation applies on the local rotation axis.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(pos {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Move 10 units on the local y axis&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getPos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,10,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the rotation of the ModelPart. Rotates the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Rotate 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setRot(0, 45, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;. Will be the Rotation values defined in BlockBench when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0) -- Most ModelParts will not have a rotation set in blockbench&lt;br /&gt;
head:setRot(45, 0, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setRot|setRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the scale of the ModelPart. Scales the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Squishes and stretches the entire model&lt;br /&gt;
models.model:setScale(1.5, 0.75, 1.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setScale|setScale]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the pivot point of the ModelPart. &#039;&#039;This overrides the pivot point defined in blockbench.&#039;&#039; It is recommended to use [[ModelParts#ModelPart:setOffsetPivot|setOffsetPivot]] instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- For a normal size humanoid model, the Head&#039;s pivot point is usually at 0,24,0&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setPivot(0, 28, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the Pivot Point defined in BlockBench, or the value set by &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; if it was already overwritten.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- The Head group&#039;s pivot point for a humanoid model is usually at 0,24,0&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,24,0)&lt;br /&gt;
head:setPivot(0,0,0)&lt;br /&gt;
-- We have completely ruined the rendering of this ModelPart&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setPivot|setPivot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a rotation value that will be added to the ModelPart&#039;s rotation.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- ModelParts inherit their rotation from blockbench. The Head usually has a rotation of 0,0,0 for consistency with the vanilla model&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
-- Set the offset to 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setOffsetRot(0, 45, 0)&lt;br /&gt;
-- The original rotation is unchanged.&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&lt;br /&gt;
-- setOffsetRot is not additive.&lt;br /&gt;
head:setOffsetRot(0, 25, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,25,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getRot|getRot]] [[ModelParts#ModelPart:getOffsetRot|getOffsetRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;. Will be 0,0,0 when the script begins&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetRot(45, 0, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetRot|setOffsetRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a scale value that will be multiplied with the ModelPart&#039;s scale.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Half the size of the head&lt;br /&gt;
head:setOffsetScale(0.5)&lt;br /&gt;
-- Results in no changes&lt;br /&gt;
-- I have no idea what this is used for&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setOffsetScale(2)&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetScale|setOffsetScale]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a value that will be added to the ModelPart&#039;s pivot point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube and offset the pivot up by 4,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setOffsetPivot(0, 4, 0)&lt;br /&gt;
-- Notice that we did not need to know the original pivot point to do this&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetPivot(0,4,0)&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,4,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetPivot|setOffsetPivot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setMatrix&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Allows you to manually define the matrix used for positioning this ModelPart. Returns self for method chaining.&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt; will undo &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;getPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;getOffsetPivot&amp;lt;/code&amp;gt; will return invalid values while &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt; is in effect. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;getTruePos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueScale&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;getTruePivot&amp;lt;/code&amp;gt; are probably also affected, but nobody tested them yet.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setMatrix(matrix {{type|Matrix4}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTruePos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the position after all calculations are done. This includes &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt; and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTrueRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the rotation after all calculations are done. This includes &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTrueScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the scale after all calculations are done. This includes &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTrueScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTruePivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the pivot point after all calculations are done. This includes &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=185</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=185"/>
		<updated>2024-09-27T00:40:48Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: /* ModelPart Methods */ added translation related methods&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What are ModelParts ==&lt;br /&gt;
A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to do achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar, and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into ModelParts.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Fun Fact: models itself is a ModelPart&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be index with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ModelPart ParentTypes ==&lt;br /&gt;
In Figura, a ParentType is applied to a ModelPart causing the ModelPart to behave in a predefined behaviour. This behaviour includes behaving like a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, and parrots, or binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself, or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a ParentType&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType and can cause unintended behaviour!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[ModelParts#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart Properties ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getName&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getType&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their face data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Child Manipulation ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getParent&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}} | {{type|nil}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getChildren&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns an array of all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart|[]}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
print(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:isChildOf&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Recursivly checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:copy&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setParentType|setParentType]], [[ModelParts#ModelPart:getParentType|getParentType]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children cause it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getName|getName]], [[ModelParts#ModelPart:getChildren|getChildren]], [[ModelParts#ModelPart:addChild|addChild]], [[ModelParts#ModelPart:removeChild|removeChild]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:addChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:copy|copy]], [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:removeChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:remove&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes this ModelPart from the parent&#039;s child list. Returns self&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;remove()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:remove() -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
models.model.root.LeftLeg:addChild(head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:addChild|addChild]]&lt;br /&gt;
&lt;br /&gt;
=== Manipulation ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setPos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the offset of the the position of the ModelPart. Position translation applies on the local rotation axis.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(pos {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPos(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Move 10 units on the local y axis&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getPos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setPos(0, 10, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(0,10,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the rotation of the ModelPart. Rotates the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Rotate 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setRot(0, 45, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;. Will be the Rotation values defined in BlockBench when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0) -- Most ModelParts will not have a rotation set in blockbench&lt;br /&gt;
head:setRot(45, 0, 0)&lt;br /&gt;
print(head:getPos()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setRot|setRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the scale of the ModelPart. Scales the ModelPart around the PivotPoint.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Squishes and stretches the entire model&lt;br /&gt;
models.model:setScale(1.5, 0.75, 1.5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
print(head:getScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setScale|setScale]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets the pivot point of the ModelPart. &#039;&#039;This overrides the pivot point defined in blockbench.&#039;&#039; It is recommended to use [[ModelParts#ModelPart:setOffsetPivot|setOffsetPivot]] instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- For a normal size humanoid model, the Head&#039;s pivot point is usually at 0,24,0&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setPivot(0, 28, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the Pivot Point defined in BlockBench, or the value set by &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; if it was already overwritten.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- The Head group&#039;s pivot point for a humanoid model is usually at 0,24,0&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,24,0)&lt;br /&gt;
head:setPivot(0,0,0)&lt;br /&gt;
-- We have completely ruined the rendering of this ModelPart&lt;br /&gt;
print(head:getPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setPivot|setPivot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a rotation value that will be added to the ModelPart&#039;s rotation.&lt;br /&gt;
&lt;br /&gt;
Angles are interpreted as degrees. &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(rot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetRot(pitch {{type|number}}, yaw {{type|number}}, roll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- ModelParts inherit their rotation from blockbench. The Head usually has a rotation of 0,0,0 for consistency with the vanilla model&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
-- Set the offset to 45 degrees on the x axis, causing the avatar to look down&lt;br /&gt;
head:setOffsetRot(0, 45, 0)&lt;br /&gt;
-- The original rotation is unchanged.&lt;br /&gt;
print(head:getRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
&lt;br /&gt;
-- setOffsetRot is not additive.&lt;br /&gt;
head:setOffsetRot(0, 25, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,25,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getRot|getRot]] [[ModelParts#ModelPart:getOffsetRot|getOffsetRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;. Will be 0,0,0 when the script begins&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetRot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetRot(45, 0, 0)&lt;br /&gt;
print(head:getOffsetRot()) --&amp;gt; vec(45,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetRot|setOffsetRot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a scale value that will be multiplied with the ModelPart&#039;s scale.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 1. If a number is provided for x and both y and z are not defined, x will be used for all 3 axis.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scale {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(scaleAll {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetScale(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
-- Double the size of the head&lt;br /&gt;
head:setScale(2)&lt;br /&gt;
-- Half the size of the head&lt;br /&gt;
head:setOffsetScale(0.5)&lt;br /&gt;
-- Results in no changes&lt;br /&gt;
-- I have no idea what this is used for&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;.  Always 1,1,1 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(1,1,1)&lt;br /&gt;
head:setOffsetScale(2)&lt;br /&gt;
print(head:getOffsetScale()) --&amp;gt; vec(2,2,2)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetScale|setOffsetScale]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setOffsetPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Sets a value that will be added to the ModelPart&#039;s pivot point.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; values are interpreted as 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(pivot {{type|Vector3}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setOffsetPivot(x {{type|number}}, y {{type|number}}, z {{type|number}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- If we assume that the Head cube is an 8x8x8 cube and offset the pivot up by 4,&lt;br /&gt;
-- then the head will rotate around the center of the cube instead of the neck&lt;br /&gt;
head:setOffsetPivot(0, 4, 0)&lt;br /&gt;
-- Notice that we did not need to know the original pivot point to do this&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getOffsetPivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the value that was used for &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;.  Always 0,0,0 when script begins.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getOffsetPivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,0,0)&lt;br /&gt;
head:setOffsetPivot(0,4,0)&lt;br /&gt;
print(head:getOffsetPivot()) --&amp;gt; vec(0,4,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setOffsetPivot|setOffsetPivot]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:setMatrix&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Allows you to manually define the matrix used for positioning this ModelPart. Returns self for method chaining.&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt; will undo &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;code&amp;gt;getPos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getPivot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getOffsetScale&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;getOffsetPivot&amp;lt;/code&amp;gt; will return invalid values while &amp;lt;code&amp;gt;setMatrix&amp;lt;/code&amp;gt; is in effect. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;getTruePos&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getTrueScale&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;getTruePivot&amp;lt;/code&amp;gt; are probably also affected, but nobody tested them yet.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;setMatrix(matrix {{type|Matrix4}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTruePos&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the position after all calculations are done. This includes &amp;lt;code&amp;gt;setPos&amp;lt;/code&amp;gt; and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTrueRot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the rotation after all calculations are done. This includes &amp;lt;code&amp;gt;setRot&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetRot&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePos()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTrueScale&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the scale after all calculations are done. This includes &amp;lt;code&amp;gt;setScale&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setOffsetScale&amp;lt;/code&amp;gt;, and the data from all playing Animations.&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTrueScale()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getTruePivot&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the pivot point after all calculations are done. This includes &amp;lt;code&amp;gt;setPivot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;setOffsetPivot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This does not include ParentTypes or transformations applied from a parent part.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getTruePivot()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|Vector3}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- no example provided&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=155</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=155"/>
		<updated>2024-09-26T23:23:45Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: /* Child Manipulation */ forgot remove&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What are ModelParts ==&lt;br /&gt;
A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to do achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar, and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into ModelParts.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Fun Fact: models itself is a ModelPart&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be index with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ModelPart ParentTypes ==&lt;br /&gt;
In Figura, a ParentType is applied to a ModelPart causing the ModelPart to behave in a predefined behaviour. This behaviour includes behaving like a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, and parrots, or binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself, or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a ParentType&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType and can cause unintended behaviour!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[ModelParts#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart Properties ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getName&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getType&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their face data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Child Manipulation ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getParent&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}} | {{type|nil}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getChildren&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns an array of all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}[ ]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
print(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:isChildOf&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Recursivly checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:copy&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setParentType|setParentType]], [[ModelParts#ModelPart:getParentType|getParentType]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children cause it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getName|getName]], [[ModelParts#ModelPart:getChildren|getChildren]], [[ModelParts#ModelPart:addChild|addChild]], [[ModelParts#ModelPart:removeChild|removeChild]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:addChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:copy|copy]], [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:removeChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:remove&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes this ModelPart from the parent&#039;s child list. Returns self&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;remove()&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:remove() -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
models.model.root.LeftLeg:addChild(head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;@see&amp;lt;/b&amp;gt; [[ModelParts#ModelPart:addChild|addChild]]&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=User:KitCat962&amp;diff=152</id>
		<title>User:KitCat962</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=User:KitCat962&amp;diff=152"/>
		<updated>2024-09-26T23:20:48Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: hehehe&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Kitcat avatar shades.png|thumb|199x199px]]&lt;br /&gt;
hehehe&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=File:Kitcat_avatar_shades.png&amp;diff=151</id>
		<title>File:Kitcat avatar shades.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=File:Kitcat_avatar_shades.png&amp;diff=151"/>
		<updated>2024-09-26T23:18:33Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: hehehe&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
hehehe&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=149</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=149"/>
		<updated>2024-09-26T22:59:52Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: /* ModelPart Methods */  @see works now&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What are ModelParts ==&lt;br /&gt;
A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to do achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar, and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into ModelParts.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Fun Fact: models itself is a ModelPart&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be index with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ModelPart ParentTypes ==&lt;br /&gt;
In Figura, a ParentType is applied to a ModelPart causing the ModelPart to behave in a predefined behaviour. This behaviour includes behaving like a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, and parrots, or binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself, or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a ParentType&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType and can cause unintended behaviour!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[ModelParts#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart Properties ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getName&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getType&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their face data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Child Manipulation ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getParent&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}} | {{type|nil}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:isChildOf&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Recursivly checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:copy&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:setParentType|setParentType]], [[ModelParts#ModelPart:getParentType|getParentType]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children cause it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:getName|getName]], [[ModelParts#ModelPart:getChildren|getChildren]], [[ModelParts#ModelPart:addChild|addChild]], [[ModelParts#ModelPart:removeChild|removeChild]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getChildren&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns an array of all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}[ ]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
print(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:addChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;@see&#039;&#039;&#039; [[ModelParts#ModelPart:copy|copy]], [[ModelParts#ModelPart:setPos|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:removeChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=148</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=148"/>
		<updated>2024-09-26T22:50:28Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: /* ModelPart:copy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What are ModelParts ==&lt;br /&gt;
A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to do achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar, and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into ModelParts.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Fun Fact: models itself is a ModelPart&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be index with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ModelPart ParentTypes ==&lt;br /&gt;
In Figura, a ParentType is applied to a ModelPart causing the ModelPart to behave in a predefined behaviour. This behaviour includes behaving like a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, and parrots, or binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself, or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a ParentType&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType and can cause unintended behaviour!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[ModelParts#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart Properties ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getName&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getType&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their face data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Child Manipulation ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getParent&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}} | {{type|nil}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:isChildOf&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Recursivly checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:copy&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
@see [[ModelParts|setParentType]], [[ModelParts|getParentType]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children cause it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
@see [[ModelParts|getName]], [[ModelParts|getChildren]], [[ModelParts|addChild]], [[ModelParts|removeChild]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getChildren&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns an array of all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}[ ]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
print(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:addChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
@see [[ModelParts|copy]], [[ModelParts|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:removeChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=147</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=147"/>
		<updated>2024-09-26T22:47:04Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: /* ModelPart:getParent */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What are ModelParts ==&lt;br /&gt;
A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to do achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar, and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into ModelParts.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Fun Fact: models itself is a ModelPart&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be index with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ModelPart ParentTypes ==&lt;br /&gt;
In Figura, a ParentType is applied to a ModelPart causing the ModelPart to behave in a predefined behaviour. This behaviour includes behaving like a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, and parrots, or binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself, or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a ParentType&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType and can cause unintended behaviour!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[ModelParts#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart Properties ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getName&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getType&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their face data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Child Manipulation ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getParent&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}} | {{type|nil}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:isChildOf&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Recursivly checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:copy&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
@see [[ModelParts|setParentType]], [[ModelParts|getParentType]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children cause it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
@see [[ModelParts|getName]], [[ModelParts|getChildren]], [[ModelParts|addChild]], [[ModelParts|removeChild]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getChildren&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns an array of all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}[ ]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
print(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:addChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
@see [[ModelParts|copy]], [[ModelParts|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:removeChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=146</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=146"/>
		<updated>2024-09-26T22:44:47Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: /* ModelPart:getType */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What are ModelParts ==&lt;br /&gt;
A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to do achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar, and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into ModelParts.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Fun Fact: models itself is a ModelPart&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be index with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ModelPart ParentTypes ==&lt;br /&gt;
In Figura, a ParentType is applied to a ModelPart causing the ModelPart to behave in a predefined behaviour. This behaviour includes behaving like a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, and parrots, or binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself, or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a ParentType&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType and can cause unintended behaviour!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[ModelParts#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart Properties ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getName&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getType&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their face data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Child Manipulation ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getParent&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:isChildOf&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Recursivly checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:copy&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
@see [[ModelParts|setParentType]], [[ModelParts|getParentType]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children cause it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
@see [[ModelParts|getName]], [[ModelParts|getChildren]], [[ModelParts|addChild]], [[ModelParts|removeChild]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getChildren&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns an array of all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}[ ]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
print(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:addChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
@see [[ModelParts|copy]], [[ModelParts|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:removeChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=145</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=145"/>
		<updated>2024-09-26T22:42:39Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: /* ModelPart Methods */ base properties and children methods&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What are ModelParts ==&lt;br /&gt;
A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to do achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar, and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into ModelParts.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Fun Fact: models itself is a ModelPart&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be index with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ModelPart ParentTypes ==&lt;br /&gt;
In Figura, a ParentType is applied to a ModelPart causing the ModelPart to behave in a predefined behaviour. This behaviour includes behaving like a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, and parrots, or binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself, or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a ParentType&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType and can cause unintended behaviour!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[ModelParts#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
&lt;br /&gt;
=== ModelPart Properties ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getName&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the name of this ModelPart. ModelParts can have duplicate names.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getName()&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{type|string}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getName()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getType&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the original type of this ModelPart. Can be &amp;lt;code&amp;gt;Cube&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Mesh&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;Group&amp;lt;/code&amp;gt;. BBModels and folders are considered Groups. Cubes with no texture data are also considered Groups, as with no texture data their mesh data is stripped.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getType()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| &amp;lt;code&amp;gt;&amp;quot;Cube&amp;quot; | &amp;quot;Mesh&amp;quot; | &amp;quot;Group&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getType()) --&amp;gt; &amp;quot;Group&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Child Manipulation ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getParent&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns the parent of this ModelPart, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; if this is &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; or a loose ModelPart created via script.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getParent()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
print(head:getParent()) --&amp;gt; ModelPart(root)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:isChildOf&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Recursivly checks if this child is a decedent of the provided ModelPart.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isChildOf(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|boolean}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local model = models.model&lt;br /&gt;
local head = model.root.Head&lt;br /&gt;
print(head:isChildOf(model)) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:copy&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Copies the data of this ModelPart, assigning it a new name, then returning it. The new name has nothing to do with ParentTypes. The children of the copy are references to the original ModelPart&#039;s children. Extra work needs to be done to recursively copy it&#039;s children. The [[ModelPart#ModelPart_addChild|addChild]] method can then be used to add the copy to the ModelPart tree.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;copy(newName {{type|string}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy) --&amp;gt; ModelPart(NewHead)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- The parentType is copied with the ModelPart&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
local headCopy = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;Head&amp;quot;&lt;br /&gt;
&lt;br /&gt;
headCopy:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
print(headCopy:getParentType()) --&amp;gt; &amp;quot;None&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
@see [[ModelParts|setParentType]], [[ModelParts|getParentType]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Extra work is needed to deep copy a ModelPart&#039;s children as well&lt;br /&gt;
local function deepCopy(model)&lt;br /&gt;
    local copy = model:copy(model:getName())&lt;br /&gt;
    for _, child in pairs(copy:getChildren()) do&lt;br /&gt;
        copy:removeChild(child):addChild(deepCopy(child))&lt;br /&gt;
    end&lt;br /&gt;
    return copy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headCube = head.Head&lt;br /&gt;
&lt;br /&gt;
-- headCopyA contains references to head&#039;s children cause it is a shallow copy&lt;br /&gt;
local headCopyA = head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
print(headCopyA.Head == headCube) --&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
-- headCopyB contains true copies of head&#039;s children as it was passed through a function that recursively copies children&lt;br /&gt;
local headCopyB = deepCopy(head)&lt;br /&gt;
print(headCopyB.Head == headCube) --&amp;gt; true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
@see [[ModelParts|getName]], [[ModelParts|getChildren]], [[ModelParts|addChild]], [[ModelParts|removeChild]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:getChildren&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Returns an array of all children of this ModelPart&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;getChildren()&amp;lt;/code&amp;gt;&lt;br /&gt;
|| {{type|ModelPart}}[ ]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
print(root:getChildren()) --[[&lt;br /&gt;
ModelPart(Head), &lt;br /&gt;
ModelPart(Body), &lt;br /&gt;
ModelPart(RightArm), &lt;br /&gt;
ModelPart(LeftArm), &lt;br /&gt;
ModelPart(RightLeg), &lt;br /&gt;
ModelPart(LeftLeg),&lt;br /&gt;
]]--&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:addChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Adds the provided ModelPart as one of this ModelPart&#039;s children. Beware of adding a parent of this ModelPart as a child! This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;addChild(part {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
|| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local headCopy = root.Head:copy(&amp;quot;NewHead&amp;quot;)&lt;br /&gt;
root:addChild(headCopy)&lt;br /&gt;
headCopy:setPos(10,0,0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
@see [[ModelParts|copy]], [[ModelParts|setPos]]&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;ModelPart:removeChild&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Removes a child from this ModelPart. Takes in the child ModelPart itself. This method returns this ModelPart for method chaining.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Arguments !! Return Type&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;removeChild(partToRemove {{type|ModelPart}})&amp;lt;/code&amp;gt;&lt;br /&gt;
| self {{type|ModelPart}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local root = models.model.root&lt;br /&gt;
local head = root.Head&lt;br /&gt;
root:removeChild(head) -- Bye bye Head!&lt;br /&gt;
&lt;br /&gt;
-- Head is still valid and can be re-added later, so long as we keep a variable referencing it.&lt;br /&gt;
print(head) --&amp;gt; ModelPart(Head)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=131</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=131"/>
		<updated>2024-09-26T21:11:35Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: &amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What are ModelParts ==&lt;br /&gt;
A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to do achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar, and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into ModelParts.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Fun Fact: models itself is a ModelPart&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be index with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ModelPart ParentTypes ==&lt;br /&gt;
In Figura, a ParentType is applied to a ModelPart causing the ModelPart to behave in a predefined behaviour. This behaviour includes behaving like a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, and parrots, or binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself, or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a ParentType&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; &#039;head&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; &#039;HeAd&#039; is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType and can cause unintended behaviour!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[ModelParts#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
This is where the methods would go, if I bothered writing them right now&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=130</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=130"/>
		<updated>2024-09-26T21:03:44Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: ////&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What are ModelParts ==&lt;br /&gt;
A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to do achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar, and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into ModelParts.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] -- access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Fun Fact: models itself is a ModelPart&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
-- Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
-- Super Mega Awsome Thing would need to be index with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ModelPart ParentTypes ==&lt;br /&gt;
In Figura, a ParentType is applied to a ModelPart causing the ModelPart to behave in a predefined behaviour. This behaviour includes behaving like a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, and parrots, or binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself, or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a ParentType&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; `head` is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; `HeAd` is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType and can cause unintended behaviour!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[ModelParts#Accessing_ModelParts|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
This is where the methods would go, if I bothered writing them right now&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=129</id>
		<title>ModelPart</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=ModelPart&amp;diff=129"/>
		<updated>2024-09-26T21:00:24Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: MODELPARTS&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What are ModelParts ==&lt;br /&gt;
A ModelPart represents a Cube, Mesh, or Group from Blockbench.&lt;br /&gt;
&lt;br /&gt;
Via scripting, ModelParts can be modified dynamically to do achieve whatever visuals you need (limited to Minecraft&#039;s rendering engine)&lt;br /&gt;
&lt;br /&gt;
== Accessing ModelParts ==&lt;br /&gt;
&amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt; is the global that acts as the Root of your avatar, and is where all ModelParts are stored, either as a child of &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;, a child of a child, or further down the tree.&lt;br /&gt;
&lt;br /&gt;
Specifically, &amp;lt;code&amp;gt;models&amp;lt;/code&amp;gt;&#039;s children are Blockbench models. When an avatar is selected, not only are a bbmodel&#039;s Cubes, Meshes, and Groups converted into ModelParts, but the bbmodel file itself is converted into ModelParts.&lt;br /&gt;
&lt;br /&gt;
To access a child ModelPart from a parent ModelPart, [https://www.lua.org/pil/2.5.html index] the parent using the child&#039;s name as a string.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local bbmodel = models[&amp;quot;model&amp;quot;] // access the bbmodel &amp;quot;model.bbmodel&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This logic is the same for every single ModelPart. If you want to access a child, index the parent with the child&#039;s name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Fun Fact: models itself is a ModelPart&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The below example accesses the Head Group from the [[WikiExampleAvatar]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models[&amp;quot;model&amp;quot;][&amp;quot;root&amp;quot;][&amp;quot;Head&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the above seems tedious, Lua provides a shorthand way of indexing with strings. It only works when the string contains no spaces or special characters.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
&lt;br /&gt;
// Below is invalid, as the name contains spaces&lt;br /&gt;
local superMegaAwsomeThing = models.model.root.Super Mega Awsome Thing&lt;br /&gt;
&lt;br /&gt;
// Super Mega Awsome Thing would need to be index with the normal method&lt;br /&gt;
local superMegaAwsomeThing = models.model.root[&amp;quot;Super Mega Awsome Thing&amp;quot;]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== BBModels within folders ===&lt;br /&gt;
When a bbmodel is within a folder, Figura will actually turn the folder itself into a ModelPart. This can be confusing as ModelParts are the only thing that does this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local folderHead = models.folder.model.root.Head&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ModelPart ParentTypes ==&lt;br /&gt;
In Figura, a ParentType is applied to a ModelPart causing the ModelPart to behave in a predefined behaviour. This behaviour includes behaving like a vanilla part like the Head or LeftLeg, moving the rendering of special parts like held items, armor, and parrots, or binding the ModelPart to the World instead of the Player.&lt;br /&gt;
&lt;br /&gt;
ParentTypes can either be applied in Blockbench itself, or via script.&lt;br /&gt;
=== ParentTypes via BlockBench ===&lt;br /&gt;
To define a ParentType in Blockbench, the name of a Group must begin with a ParentType&lt;br /&gt;
&lt;br /&gt;
For example, the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType causes the ModelPart to move and rotate like the vanilla Head. If you name a Group the following, it will have this ParentType:&lt;br /&gt;
&lt;br /&gt;
* Head&lt;br /&gt;
* HEAD&lt;br /&gt;
* Head2&lt;br /&gt;
* HeadPhones&lt;br /&gt;
&lt;br /&gt;
If you name a group the following, &amp;lt;b&amp;gt;it will not&amp;lt;/b&amp;gt; have the &amp;lt;code&amp;gt;Head&amp;lt;/code&amp;gt; ParentType:&lt;br /&gt;
&lt;br /&gt;
* head    =&amp;gt; `head` is not a valid ParentType. Capitalization matters!&lt;br /&gt;
* BigHead =&amp;gt; Does not begin with ParentType&lt;br /&gt;
* HeAd    =&amp;gt; `HeAd` is not a valid ParentType. Capitalization matters!&lt;br /&gt;
&lt;br /&gt;
Do note that some English words naturally start with a ParentType and can cause unintended behaviour!&lt;br /&gt;
&lt;br /&gt;
For example, the word &amp;quot;Guitar&amp;quot;. Seems innocent, right? Well, &amp;quot;Guitar&amp;quot; starts with &amp;quot;Gui&amp;quot;, and &amp;quot;Gui&amp;quot; is an alias for the ParentType &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt;, a ParentType that binds the ModelPart to the Heads Up Display where the hotbar and inventory reside. This causes the ModelPart to not be visible, as &amp;lt;code&amp;gt;Hud&amp;lt;/code&amp;gt; parts have special rules. Be careful!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Note: ParentTypes are sometimes called Keywords by legacy Figura users&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ParentTypes via Script ===&lt;br /&gt;
Calling the &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on &amp;lt;em&amp;gt;any&amp;lt;/em&amp;gt; ModelPart will override it&#039;s ParentType.&lt;br /&gt;
&lt;br /&gt;
Simply [[ModelParts#index|access]] the ModelPart, then call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; on it, passing in the ParentType as a string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;RightArm&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To remove a ParentType from a ModelPart, call &amp;lt;code&amp;gt;setParentType&amp;lt;/code&amp;gt; with the string &amp;lt;code&amp;gt;&amp;quot;None&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ModelParts &amp;lt;b&amp;gt;do not&amp;lt;/b&amp;gt; remember their original ParentType! If you need a ModelPart&#039;s original ParentType, store it in a variable for later:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local head = models.model.root.Head&lt;br /&gt;
local headParentType = head:getParentType()&lt;br /&gt;
head:setParentType(&amp;quot;None&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== ModelPart Methods ==&lt;br /&gt;
This is where the methods would go, if I bothered writing them right now&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
	<entry>
		<id>https://wiki.figuramc.org/index.php?title=User:KitCat962&amp;diff=101</id>
		<title>User:KitCat962</title>
		<link rel="alternate" type="text/html" href="https://wiki.figuramc.org/index.php?title=User:KitCat962&amp;diff=101"/>
		<updated>2024-09-26T20:07:14Z</updated>

		<summary type="html">&lt;p&gt;KitCat962: page added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;hehehe&lt;/div&gt;</summary>
		<author><name>KitCat962</name></author>
	</entry>
</feed>