[HELP] Enemy not moving with A* Pathfinding

Updated on January 17, 2018 in [A] 2D
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
1 on January 16, 2018

Hey guys!

I’m new here, and was just following Brackey’s old video: https://www.youtube.com/watch?v=3PS1U3lFl3M in which he uses the A* Pathfinding project to develop enemy pathfinding. At the end, after he finishes writing his code, his alien ship is able to chase him around freely.

Problem is, I followed his instructions to the dot, and when I try it with my project, my enemy does not move at all. Has something changed in recent updates? 

The only thing different is that I’m using a tileset for terrain, and my enemy has a capsule collider on. My console says that the enemy is constantly checking for a path to my player, but there is 0 movement.

Any help would be appreciated!

  • Liked by
Reply
0 on January 17, 2018

EDIT: I SOLVED IT! 😀

It was a very silly mistake in the FixedUpdate where I did this:

if (currentWaypoint <= path.vectorPath.Count)

instead of this:

if (currentWaypoint >= path.vectorPath.Count)

So if any of you run into a similar problem, you should fix it. Please check your code for small errors like these.

  • Liked by
Reply
Cancel