- Home /
How do I make the enemy move along with the Pathfinding path?
Hello! I'm new to Unity and C# in general. I followed a tutorial on how to make a pathfinding system, and it actually worked pretty well, but what I really wanted to do is to make the blue cube follow the red cube.
How exactly can I make the blue cube move along the traced path? Thanks in advance!
The tutorial I followed: https://www.youtube.com/watch?v=-L-WgKMFuhE&list=PLFt_AvWsXl0cq5Umv3pMC9SPnKjfp9eGW
Answer by Link17x · Mar 16, 2020 at 11:04 PM
For this kind of thing, I have always used the Navigation Mesh. It might seem a tad daunting at first glance but it's actually very easy, especially for following. Here is a tutorial series on implementing it: https://www.youtube.com/watch?v=NGGoOa4BpmY
The basic area is you create a navigation mesh, which defines the area that can be walked (or unwalkable). Then you have a Nav Mesh Agent component that can set its path to the location of your red cube (or whatever). Then it will navigate around the walkable area to your set destination!
You can go further with this approach and add more diversified pathfinding, obstacles and whatnot. The video link should be enough to get you started though, goodluck.
Thanks a bunch! I will watch that tutorial you've linked. Thanks!
Your answer

Follow this Question
Related Questions
NavMeshAgent Move towardes the final point in the path directly 0 Answers
Follow Dynamic Path At Runtime 3 Answers
How can I prevent a character from ignoring it's waypoint path? 1 Answer
How to Draw a line and make a 3D character follow it 1 Answer
Transforming non deterministic game to deterministic 1 Answer