Using the Target Position Modifier - Black-Horizon-Studios/Emerald-AI GitHub Wiki
Using the Target Position Modifier
The Target Position Modifier component modifies the height of non-AI targets and player targets allowing AI agents to target a modified position instead of using the model's center position. This is helpful if you find an AI targeting their target incorrectly. This is especially useful for targets who have a center position near the base of the model.
Note: Version 3.0+ of Emerald AI is required to use this feature.
Step 1
First, you will need to add the TargetPositionModifier component to the desired object or player. You can do this by selecting the object, pressing the Add Component button, and typing in TargetPositionModifier.
Selecting the script will add it to your object.
Step 2
When assigning the TargetPositionModifier component to your object for the first time, the default position will be placed at the object's center position, which will likely be near the base as shown below. (Invector character controller is being used in this example)
If you are using a Target Position Modifier on your player, you will need to set the Position Source to Collider. This will allow the Target Position Modifier to use your player's collider's bounds for calculating the height.
This will allow for improved positioning and allow the position to dynamically adjust if your player's collider changes height for something like crouching. However, this will still require some modification.
Further adjust the Height Modifier so that it's near the player's head or chest area. Ensure that this is still well within the collider's area or else it can cause detection issues. All Emerald AI agents will automatically aim or look at this point instead of the object's center position.
Step 3
Ensure everything is working correctly by watching the Target Position Modifier point during runtime. If you character controller supports crouching, ensure the position of the point properly adjusts to the height changes as it should stay at the same height within the collider.
Note: Ensure that the gizmo does not go into the ground or go above the collider as this could make a target undetectable to AI.