Skip to Content
FeaturesPart Visibility

Part Visibility

Part Visibility is a feature that goes inside the features code block.

It would look like this:

"features": [ { "type": "PartVisibility", "parts": [ ] } ]

What does it do?

It allows you to control which parts of the gun to hide or show. You can set up conditions so that based on if x or y happens, different parts of the gun hide and/or show. It’s a very versatile feature that can be used for a lot.

‘Parts’ of the gun means the bones inside the Blockbench model. Bones are often used for animating. In this case, they also act as parts designated to hide or show.

One common use is:

Designing iron sights to flip or stay unflipped depending on whether a scope is attached on the gun. Basically, you have two iron sight models in the same gun model: one of them is flipped, and the other is not flipped. When the gun doesn’t have a scope on, you can set the flipped version to hide, and the unflipped version to show. If the gun has a scope on, the flipped version can show, and the unflipped version can hide.

Example code block:

{ "type": "PartVisibility", "parts": [ { "name": "flipped", "visible": true, "condition": { "hasAttachmentGroup": "ar_sightsandscopes" } } ] }

In this example, there is one part inside "PartVisiblity" called ‘flipped’. It’s set to visibility ‘true’ under the condition ‘has attachment group “ar_sightsandscopes”’. If the gun has any attachment from the “ar_sightsandscopes” attachment group, then ‘flipped’ will be set to visible.

Here’s a more complete code block:

{ "type": "PartVisibility", "parts": [ { "name": "flipped", "visible": true, "condition": { "hasAttachmentGroup": "ar_sightsandscopes" } }, { "name": "fsflipped", "visible": true, "condition": { "hasAttachmentGroup": "ar_sightsandscopes" } }, { "name": "rearsight", "visible": false, "condition": { "hasAttachmentGroup": "ar_sightsandscopes" } }, { "name": "frontsight", "visible": false, "condition": { "hasAttachmentGroup": "ar_sightsandscopes" } } ] }

In this example, there are 4 parts, each set to visible ‘true’ or ‘false’ based on their own conditions.

Last updated on