Smart AI with NavMesh

What if your player goes through an object when you click the other side of that object? It shouldn’t be like that, right?

Since we added the NavMesh and made the player move in the last article. The player moves but it moves through objects. Now we will fix this by making these objects static.

Create Static objects

  1. Choose the objects which will be static
  2. Then you go to Inspector and click Static

3. After that, you go back to the Navigation Tab, click Clear, and then Bake again.

4. Now if you have your Gizmos on you should see grey areas around those objects you just made static.

5. And now your player can’t go through those objects! :)

--

--

--

From the beautiful snowy country with a touch of "good" humor? Inspired Unity Developer to learn more.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

An Introduction

Hacktoberfest

Why Flutter for Mobile App Development

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

Ripple effect in Aerospike cluster: Production issue debugging

Fig. Aerospike 3 node cluster

Getting started with publish

Large Type legacy celebrated in 80 line Go program

Windows as a developer environment

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
Janika Suhonen

Janika Suhonen

From the beautiful snowy country with a touch of "good" humor? Inspired Unity Developer to learn more.

More from Medium

Script communication in unity using GetComponent:

Talking to your unmanaged code efficiently from Unity using P/Invoke

A quick guide to player setup in Unity

The simplest way to create a First Person Shooter! (Part 3)