PuppetMaster Integration Tutorial - Black-Horizon-Studios/Emerald-AI GitHub Wiki
PuppetMaster Integration Tutorial
This tutorial will help users get Emerald AI working with PuppetMaster. This allows AI to be knocked with down ragdoll physics and get back up.
Note: Emerald AI 3.2.1 or above is required for this tutorial.
Step 1
First, users will need to import the included PuppetMaster Support (UnityPackage) file. This is located within the Emerald AI>Integrations>PuppetMaster folder. Ensure that you have PuppetMaster within your project before importing. This will add additional items to PuppetMaster Support folder.
After you have imported the PuppetMaster Support (UnityPackage) file, you should see the following. It is recommended that users test out the included PuppetMaster Example scene to see how things work and are setup.
Step 2
Select the desired AI and set it up as PuppetMaster recommends. This will add additional PuppetMaster components and place your Emerald AI agent within a Puppet parent.
Step 3
Find the gameobject containing your Emerald AI Editor and apply a Location Based Damage component to it. Once done, press the Get Colliders button on the Location Based Damage component. This will get all the ragdoll components that were created during the PuppetMaster setup from the step above.
Step 4
Find the PMEmeraldAIExtension script and assign it to the gameobject containing your Emerald AI Editor. This stops certain functionality when the AI is unbalanced or killed. You can manually assign the PuppetMaster components or the script will attempt to automatically find them.
Step 5
PuppetMaster requires certain Animation States be added to an AI's Animator Controller. All you have to do is find the Humanoid Puppet (included with PuppetMaster), select the BehaviorPuppet and BehaviorFall states, and copy them.
Step 6
Next, go to your AI's (Emerald AI) Animator Controller and paste the states you just copied. These will allow the AI to play these states and their animations when needed.
Note: You will need to manually change the PuppetMaster animations through these states if you want to customize the animations (as recommended by PuppetMaster). These default animations may not be compatible with your model's rig so ensure they work correctly. If your AI cannot stand up, or goes continuously through the floor, it most likely means the animations will need to be swapped out for ones that are compatible.
Step 7
Since AI who use PuppetMaster have to use the Location Based Damage (LBD) component, you will need to follow This Step if you would like to apply custom damage to your AI. AI who use LBD use different components and code for damage.
Step 8
The AI should now be working with PuppetMaster. Test the AI out to ensure everything is working correctly. The AI should be able to be knocked down with ragdoll physics and get back up.
Note: Because the Layer Collision Matrix is project dependent, you may need to adjust these based on what PuppetMaster suggests. These will be visible in the form of error in the Unity Console from PuppetMaster.