📖Auto Rig Chest Documentation
Last updated
Last updated
Video with examples:
Auto Rig Chest is a Unity Editor script designed to create rigged model versions of existing chests, footlockers, trunks, and similar container objects, making them compatible with Treasure Chest Animations.
Not all models are compatible with Auto Rig Chest. Only models that have its base mesh and lid mesh as separate objects can be used.
To access the script, navigate to the Unity Editor top menu bar: Tools > Kevin Iglesias > Auto Rig Chest
For this example, this chest will be used: Treasure Chest - AKU (https://assetstore.unity.com/packages/3d/props/treasure-chest-aku-88449)
When you open the window, you'll see a step-by-step guide (1 to 5) along with some fields and buttons.
The Auto Rig Chest window is dockable, like other Unity Editor windows.
If you see this message: '[✘] Template rig source model not found in project.' (as shown in the image below), reimport the script and ensure that the TreasureChestTemplateRig file, located in the same folder as the AutoRigChest.cs script, is also imported.
Step 1. Drop template rig source model to your scene.
First, we need to put the source template rig model (TreasureChestTemplateRig) in our scene at the same position we have the chest we want to rig.
It is recommnended to create a new empty scene and place both the TreasureChestTemplateRig and the chest you want to rig at the scene's center (0, 0, 0) position.
Step 2. Assign the template rig source model from your scene to this field:
After dropping the TreasureChestTemplateRig in our scene we must assign it to the field in this step. Remember this must be at the same location of our chest to be modified.
Step 3. Locate and assign mesh game objects of your chest:
In this step we must locate the base and lid mesh of our chest and assign them to each Chest Base and Chest Lid fields in the Auto Rig Window.
Step 4. Place template rig at your chest and match bones to your chest parts.
We should already have our template rig model at the same position of our chest. Now we must make each part of it match the corresponding parts of our chest.
It is important that we start adjusting the bones in order. First we adjust the 'B-back' bone from the template rig to the back part of our chest. Like in these images:
Then, we do the same but for the front of the chest, moving the 'B-front' bone.
And for both sides, adjusting the left side first ('B-leftSide'):
After adjusting the sides (back, front, left and right) we can now adjust the lid. The lid must match the chest lid position and rotation. The position must be right where the hinge center should be. And if the lid of our chest is closed, we must adjust the template rig lid to be closed too.
If your chest also have handles (and they are separate meshes from the base) they can also be rigged and animated. Match each B-handle to their side, and rotate them accordingly.
Step 5. Give a name and set export file path:
After adding a name we will be able to use the 'Create Chest Rig' button that will create our new chest. The default path is 'CreatedChests' folder inside the same folder of the 'AutoRigChest.cs' script but you can change it by pressing the button with the three dots at the end of the path field. This path can only be a path inside the Assets folder of the current Unity project.
After we press 'Create Chest Rig' we will see a new generated chest in our scene:
This new chest will be able to play Treasure Chest Animations. It is a prefab using new mesh files, so it works independently of the original chest asset files. But it will still be using the materials assigned to its parts when created. If you want to use this prefab in other projects, don't forget to copy or move the materials to the same folder.
A quick way to get to the folder of our new chest is to right click on its name on the hierarchy from our scene, then select 'Prefab' and then 'Select Asset'. This will change the directory of our Unity Project window to the path with our new rigged chest files:
You can then drag the same 'TreasureChest' Animator Controller to the new prefab chest and it will play the same animations as the example models of Treasure Chest Animations like in this video:
You can export the rigged model for use in other game engines along with the animations. The animations are already in FBX file format and can be read by most of game engines. For the rigged chests made by Auto Rig Chest you can use the Unity FBX Exporter package. To install it you must open the Package Manager. To access it, navigate to the Unity Editor top menu bar: Window > Package Manager
Then select Unity Registry packages and use type 'fbx' in the search bar.
After installing the FBX Exporter package, you will see this option in the GameObject menu from the top bar:
While having our chest prefab selected (from the project window or the scene directly), click on 'Export to FBX...' option.
I recommend these export options:
By default it will export the new chest in the Assets root folder. You can use the exported FBX file outside Unity projects, like Godot or Unreal projects.
For questions and issues send an email to: support@keviniglesias.com
Visit my website for more tools, 3D models and animations: www.keviniglesias.com