Implementing a simple crowd simulation

Our implementation will be quick, simple, and effective, and it will focus on using Unity's NavMesh feature. Thankfully, NavMesh will handle much of the heavy lifting for us. Our sample Crowds scene has a simple walking surface with a NavMesh baked onto it, a couple of targets, and two teams of capsules, as shown in the following screenshot:

The classic scenario: red versus blue

In the preceding screenshot, we can see that our red and blue targets are opposite their teams: red and blue, respectively. Your guess is as good as mine as to why the blue and red clans just can't get along, but it'll work for ...

Get Unity 2017 Game AI Programming - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.