AI Control
The Mech Combat Kit includes an example AI that patrols between waypoints and can engage a target when it sees one.
The main demo scene includes multiple AI mechs that have been set up to spawn in the game. Take a look at the setup first before making your own. You can also copy and paste the mech instances to add more mechs.
Read up on the Game Agent/Vehicle framework here that is used by both the player and the AI.

Creating An AI Pilot

To create an AI mech pilot, add a Game Agent component to a gameobject, go to the inspector, uncheck the Is Player checkbox, and set the Team.

Creating an AI Mech

The AI uses the exact same mech(s) as the player, there's no need to set up anything differently.

Setting Up The AI Controller

Add an AI Controller component somewhere in the hierarchy of your mech pilot (where the Game Agent component is).
This component contains settings you can adjust to change the way the mech patrols and engages in combat.

Patrol Routes

To create a patrol route for an AI mech, add a Patrol Route component to a gameobject in your scene. Next, add as many waypoint transforms as you wish to the hierarchy and place them where you want the mech to go. The mech will move sequentially between the waypoints, through the list on the Patrol Route component's inspector.
Drag the Patrol Route component you added into the Patrol Route variable in the inspector of the AI's AI Controller component.

Combat Zones

A combat zone is simply a volumetric shape that describes the area in which a mech will move around while engaging a target. This is useful to prevent mechs from moving away from defended positions and running into obstacles.
During combat, the AI mech will stay within the specified combat zone while attacking and evading fire.
To create a new combat zone, add a Combat Zone component to a gameobject in your scene. The shape will be displayed in the scene view.
Next, drag the Combat Zone component you added into the Combat Zone variable in the inspector of the AI's AI Controller script.
​
Copy link
On this page
Creating An AI Pilot
Creating an AI Mech
Setting Up The AI Controller
Patrol Routes
Combat Zones