Godot Pathfinding Help?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By HD

Can anyone give me a code for pathfinding using Navigation2D node (or explain)?
Please notice I’m new to Godot.
I followed a video made by KidsCanCode but it’s not working on Godot 3.0

:bust_in_silhouette: Reply From: duke_meister

That KidsCanCode video is pretty good and will work on Godot 3.0 (I’m using 3.0.4 Mono).
What in particular didn’t work? Did you download their code or type it in yourself?

I recently struggled to get it going also, with a Tilemap, but eventually got there. I’m at work now but if you don’t have an answer soon I can post some code.

Edit: Try this tutorial also. It’s always good having multiple explanations of the same thing, I find:) You want the first part. The second part goes into A*/AStar, which you might find interesting also.

I have it on my list to make an updated version. :stuck_out_tongue:

But yes, the process hasn’t really changed for 3.0, just some of the details.

kidscancode | 2018-07-05 00:09

Your video helped but I think in the end I used the code (changed to C#) from this video It’s also a more recent one from April this year.

Incidentally I was stumped in your KidsCanCode video trying to draw the polygon for my NavigationPolygonInstances until I noticed the ‘weird’ symbol next to your Sprite nodes. Then I noticed there was a button on the button bar with the same symbol. The tooltip said “Makes sure the object’s children are not selectable”. This did the trick.

duke_meister | 2018-07-05 09:21

Thanks. That “Makes sure the object’s children are not selectable” method worked.

HD | 2018-07-05 12:36

Hi, KidsCanCode Thank You for your reply and your videos.
They are really helpful.
Now my pathfinding is working but my sprite go halfway into other tiles with no NavigationPolygonInstances. Is there any way to solve this?

HD | 2018-07-05 13:34

That sounds like a collision issue not a pathfinding one. You might want to ask another question about that.

duke_meister | 2018-07-05 22:03

I’m going to try something out right now.
If that didn’t work I will post another question.
Thank You !!!

HD | 2018-07-06 11:23