Unity: NavMesh, Crowd Behaviour and Wandering AIs

If you’re interested in creating projects or games with Unity that utilize or simulate crowd behavior (think FP zombie shooter wandering NPCs), I found this video from Holistic3D to be extremely helpful as a starting point. This tutorial is very simple and uses a combination of Navmesh and way points to give your AIs (agents) a the semblance of . This is very basic but can be easily built upon if you want to forgo the waypoints and employ something like a simple wander script if you prefer to make your AIs appear just a little more “human” in a sense. I will talk about wander scripts in more detail in a later post.

I won’t write up a whole walkthrough for you as following the above tutorial will be much more valuable in the long run but the setup is this: start with a plane, add some cubes for walls, create some cylinders (agents), assign waypoints for each and most importantly, add navigation via the aforementioned Navmesh. Finally, add just a small bit of code to attach to your agents will help them to navigate to their respective home locations. Once the basics are in place for your individual agents, you can simple duplicate them to infinity (or as much as your PC can take) by using our friend CTRL-D.

Voila: Instant crowd.

One thought on “Unity: NavMesh, Crowd Behaviour and Wandering AIs

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.