Using the Built in IK System - Black-Horizon-Studios/Emerald-AI GitHub Wiki
Using the Built-in IK System
Emerald AI features a built-in IK system that's accessible right from within the Emerald AI Editor. This system allows AI to use IK to look at targets with their heads and bodies while in and out of combat. Emerald AI Agents that use the Emerald IK Type will only use it during combat and if they are using the Ranged Weapon Type.
Note: The Emerald IK Type is only available with Emerald AI 3.0.
Table of Contents
Unity IK
All AI that are not in combat will use the Unity IK type, which uses Unity's built-in IK system. AI who use the Melee Weapon Type will also use the Unity IK Type.
Step 1
First, you will need to ensure your AI's Animation Type for their model is set to Humanoid as this feature is only available for the Humanoid Animation Type. So, this feature will not work for quadrupeds.
Step 2
To enable the IK feature, go to Detection & Tags>Look At Options within the Emerald AI Editor and set Use Look At to Yes. This will enable the feature and open up more options.
Most of the options are straightforward and have descriptions of their usage right within the Emerald AI Editor. The Head Look Weights control the strength of how much the AI's head is affected by the look at feature. There are options for both non-combat and combat. The same goes for the Body Weights, but control the strength of how much the AI's body is affected by look at feature.
Emerald IK
The Emerald IK Type is only used for AI who use a Ranged Weapon, such as a gun or bow. The Emerald IK Type is also only active when a ranged AI is in active combat. When a ranged AI is not in combat, or an AI is melee combat, they will automatically use the Unity IK Type.
Step 1 (Emerald IK Type Only)
AI who use the Emerald IK Type have most settings automated internally. The only setting the user has to worry about within the Look At Options tab is supplying a Bone Object that the Emerald IK Type will control for the IK process.
To add a Bone Object, press the + sign within the Bone Object List then choose the appropriate bone object. A minimum of 1 Bone Object is required (with a maximum of 3) which must by either a Spine or Chest bone.
Step 2 (Emerald IK Type Only)
When using the Emerald IK Type, it is important that you setup your AI's Ranged Attack Transform correctly. For best results, it's recommended that users use an Empty GameObject or a Primitive GameObject (Ensure you remove all colliders from your created Ranged Attack Transform) that is parented to the ranged weapon near its muzzle or where you would like the projectiles to shoot from.
Note: It is very important that the Ranged Attack Transform's local forward position (Blue Arrow) is facing as shown or else the AI may have incorrect aiming. However, most weapons should be correctly modeled to automatically have this and simply setting all rotations to 0,0,0 should suffice.
Step 3 (Emerald IK Type Only)
Lastly, assign the Ranged Attack Transform GameObject as the Emerald AI Ranged Attack Transform located under AI's Settings>Combat>Damage Settings.