0 votes

Hi,
I'm creating my maps with a random walker system similar to Heartbeast's and am trying to set up navigation with the navigation 2D node for this. I got it to work fine with a handmade navigationpolygon but obviously I cant handmake it for a randomly generated map. I haven't been able to find anything about this in Docs or online.
I have tried setting up navigation on the tileset but that didn't work. Should it?

Godot version v3.5.stable.official [991bb6ac7]
in Engine by (12 points)

1 Answer

0 votes

Change the polygons inside your NavigationPolygon resource with a script. You can either add vertices and matching polygons arrays or you can define outlines arrays and use makepolygonsfrom_outlines() to create a procedual navigation polygon. It is important to note that you polygon edges can not intersect and if you use outlines the outlines can not overlap and intersect.

When you finished changing the NavigationPolygon you need to first set the current NavigationPolygonInstance navpoly = null before you apply the changed polygon, else the update will be blocked cause it is still the same resource.

TileMap baked navigation is highly inefficient for this, don't use it.

by (192 points)
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 Frequently asked questions and 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 [email protected] with your username.