Formations

To use a formation:

1- Create the formation manager (Go to the menu Easy AI/Create/Formation Manager).This will create a gameobject named Formation Manager with the script Formation Manager.

unity-menu

2-Select the gameobject Formation Manager and select the type of formation that you want. For example:

formationType

3-Now the next step is to create an agent. There are several ways to create an agent.

You can go to the menu Easy AI/Create/Agent to create an example agent

CreateAgent

If you don’t want to create an example agent, you only must select your gameobject and go to the menu Component/Easy AI/Formation/Agent

addComponentAgent

And this will add the components that you gameobject need to be an Agent.

Don’t forget that all the agents must have the same tag. Example: Team1.

4- Select the formation manager gameobject and in the field Tag Of Agents select the tag that has all of the agents. Example: Team1.

TagOfAgents

5- If you click the Load Agents From Tag button and turn green all agents was loaded  successfully.

loadAgentsFromtag

zLookAhead

The distance to look ahead to the destination. The higher the value the better the agent will avoid obstacles and less keep formation

formationSpeed

The agent move speed as the group is forming and advancing

target

The target that the formation must go to.

TRIANGLE

Length

The length of the triangle

CIRCLE & SEMICIRCLE

concave

(ONLY FOR SEMICIRCLE) If you want that the semicircle will be concave.

radius

The radius of the circle or semicircle.

V & WEDGE

_separation

The separation between agents in the formation.

fill

If you want that the agents fill the formation.

COLUMN

Columns
The number of columns to form.

DIAMOND

backPositionOffset
Should the back agents have a left and right offset?

LINE

Right
Should the formation be to the right of the leader?

DIAGONAL

Right
Should the formation be to the right of the leader?

GRID

Columns
The number of columns to form.

TagOfAgents

The tag of the agents that will be formed.

Load Agents From tag

If this button is of green color all of the agents was loaded successfully.

 

API Set Target from run time:

FormationManager.current.target = MyTarget; // <= as GameObject
API Formation Type from run time:
FormationManager.current.formation = Formations.Circle;
in Formations