Game Development Reference
In-Depth Information
FlockGroup
is the main class to hold a group of characters, and it has several set-
tings we can customize:
•
Flock Type
: This is
Ground
or
Air
and defines whether the AI characters will
move on a plane (ground) or move in all three axes (air). If set to
Air
, charac-
ters will ignore any terrain. You might think we would set our ships to air, but
we want them to all hover at the same height, so keep this set to ground.
•
Num Agent
: This is the number of agents (or AI characters) in the group.
This can be a very high number as Fame is efficient, but for our demo, we
will set this to 8.
•
Avatar
: This is the GameObject set to be the individual members of the
crowd. For our demo, this is the ship model.
•
FlockMemberScript
:Youcancreateacustomscripttodefinehowthemem-
bers of your crowd will act. For this demo, we will keep things simple and use
Fame's default
FlockMemberScript.cs
script.
The following screenshot shows our Fame
FlockGroup
settings for the ship group:
Setting up a group
Next, we need to create the initial formation we want our group to be in. With the
Ships
GameObject selected, you will see three connected gizmos in the Unity 3D
view that represent the shape of the initial group. Go to
Formation Shape
in the
In-
spector
panel for
Ships
and click on
Add Point
. This creates a fourth point for the
shape of the group. Arrange the points into a pyramid-like shape and click on
Create
Avatars
. A set of ships in a group will be created: