0 votes

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

in Engine by (15 points)

1 Answer

0 votes
Best answer

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.

by (714 points)
selected by

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

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

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.

Thanks. That "Makes sure the object's children are not selectable" method worked.

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?

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

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

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.