Setting up a Player with Emerald AI
Last updated
Last updated
To get started, it is recommended that you use the included EmeraldGeneralTargetBridge script. This script can be attached to any GameObject, including players, which will then allow it to be properly detected and receive damage calls from AI.
Add the EmeraldGeneralTargetBridge component to your player. Upon doing so, it will add 2 additional components; a Faction Extension and a Target Position Modifier.
Note: If you created a custom player bridge script, the Faction Extension and Target Position Modifier scripts will also be added. You will not need to have the EmeraldGeneralTargetBridge present if you are using a custom player bridge script.
The Faction Extension allows you to specify the faction the player will belong to. For this guide, we will be using the Player faction.
The Target Position Modifier works exactly as it does with AI. You simply need to apply a transform source that will be used as the aim point for other targets. For a detailed guide on setting this up, see the Target Position Modifier section.
Ensure your tags and layers are set for your player. These are project dependent and depend on the character controller you are using. Make sure that these are added to your AI's Detection Layers and Player Tag within their Detection Component.
Your player object should now be able to be detected by other AI and receive damage through the EmeraldGeneralTargetBridge script. If you would like to have your custom player controller's health damaged directly, you will need to create a custom script. For a guide on this, see the Damaging a Custom Character Controller section.