Working with Unity’s Nav Mesh System for Smart AI

In the last tutorial it covered creating a point and click movement system using Unity’s Nav Mesh System. You can find that tutorial here. This is a review of how to setup a Nav Mesh AI. First you need to open the Navigation window. That can be found in the Window->AI menu dropdown.

This example uses a plane for the floor, a capsule for the player, and cubes for obstacles. For movement, this will use the point and click movement from the previous tutorial. Make sure you give your player the component Nav Mesh Agent. This will allow your player to navigate the area you have created.

With the Navigation window open you can see it has 4 sub areas: Agents, Areas, Bake, and Object. Agents will give attributes to the player, enemies or anything else that will use the Nav Mesh for navigation. Areas are how you define different objects and how the Nav Mesh will interact with them. This tutorial will only use Walkable and Not Walkable. Bake is where you update the Nav Mesh by Baking it. Object is where you can set what type of Area an Object is.

As you add objects that will be part of the Nav Mesh you need to set them to static and then set if they are Walkable or Not Walkable. Then make sure you bake your Navigation again. You will see that it updates the blue Nav Mesh area around the new cube so that you will not run into it as you move about.

If you have an object that is walkable and it is below the step height when you update the Nav Mesh it will now turn blue so you can move onto it.

These are the basics of adding objects and incorporating them into your Nav Mesh. You can start building terrain using this method and have a moveable environment.

-Chris

--

--

--

Recommended from Medium

Learning Artificial Intelligence with Udacity

5 Ways Artificial Intelligence In Health Care Will Change The Way We Live

5 Ways Artificial Intelligence In Health Care Will Change The Way We Live

What is Edge AI?

5 Biggest Myths Holding Back Your Chatbots’ Strategy

AI Supports Automatic Generation of 90.4% of Frontend Modules during Double 11

How to build a killer chatbot for your business?

Demystifying AI: Artificial vs. Augmented Intelligence

How I boosted and made exponential growth for my new start up using Artificial intelligence and…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Christian Carter

Christian Carter

More from Medium

C# scripting in Unity — Day 01

Quick tip — Enabling post-processing in Unity Universal Render Pipeline

2.5D Platformer — Improving the Ledge Grab #10

Learn to code by making a 2.5 D space shooter game.