First navigation polygon didn't work, had to back up and simplify

I made this navigation setup, only to discover that it didn’t work.

When I call get_simple_path, I get back a blank array, and then get an error when I try to do position.distance_to(path[0])

I spent a long time trying to figure out what was wrong with my code, and finally decided to instead make a very simple scene.


That worked great! So no problem with my code. I made a second, only slightly more complicated level to make sure I was outlining inner obstacles correctly, and it worked too.

So something is wrong with my more complicated level. I notice that the two scenes that work have green shaded areas, like Yann’s video, while my failed navigation looks more brownish. I can’t find any documentation about what that color means.

Instead of trying to fix the bad navigation, I deleted both the Navigation2D and Destination nodes and am putting them back one small area at a time. I started with just the top left room, one guard, and a few destinations. Then I added polygon points and a new destination to let the guard move down the hallway. I’m gradually expanding the navigation area, adding destinations and guards as I go. I might recommend this ‘start small and build out’ approach over trying to define the entire navigation polygon in one go.

Privacy & Terms