Creating A Modular Waypoint System For Your AI To Follow On Your Nav Mesh

Sometimes, when creating the movement for an AI, you may want to determine a set path for them to navigate. To do this, you will likely need to create a “Waypoint System” so that your AI knows its target destinations.

You’ll need to create a “List”, which will hold the transforms of all your AI’s waypoints.

Next, create a reference to your “Nav Mesh Agent” and call it in void Start.

Then you’ll need to create an “Integer Variable” to hold your AI’s current target from the list.

And you’ll also need a “Boolean Variable” to reverse your AI’s progression through the waypoints.

[Important Note]

Don’t forget that you will need to add the namespace “using UnityEngine.AI;” if you are wanting to access Unity’s Nav Mesh components.

Now in Unity, you’ll need to create empty game objects for each waypoint within your hierarchy and adjust their transform position to your desired waypoint locations.

And lastly, drag and drop those waypoints onto your script in the inspector.

--

--

--

Hi, my name is Adam Reed and I am a software engineer specializing in Unity and C# development. Feel free to scroll through and check out some of my work!

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

Recommended from Medium

Edge AI Applications: Discover the Secret for Next-Gen AI

Edge AI Applications: Discover the Secret for Next-Gen AI

Virtual Assistants for Business with Watson

AI as an Technology

Folk the algorithms: traditional music in AI music research

Racist Self-Driving Cars Concerns Are (Well-Intentioned) Clickbait

Intelligent Architecture towards integration

Driverless AI can help you choose what you consume next

Viola.AI Updates #18: 18 Days to ICO

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
Adam Reed

Adam Reed

Hi, my name is Adam Reed and I am a software engineer specializing in Unity and C# development. Feel free to scroll through and check out some of my work!

More from Medium

Variables! — The building blocks of programming

Zoo Cards as Scriptable Objects

4 Ways of Playing Animation-Related Sounds in Unity

How to Remove a Large File from Commit History in Git?