After setting up the navigation region on a tilemap by drawing little squares where an agent can traverse, how does one use this (for finding paths and such)?
Selecting "Bake Navigation" in the Tilemap properties doesn't do anything, even if the parent of the node is a Navigation 2D node. In looking at other people's work, I find that people just use a Navigation Polygon instance instead, which seems inferior to me because I want to alter the tilemap during run time and alter navigation.
Setting up tilemap with navigation
Maybe you could take a look at this:
https://godotengine.org/asset-library/asset/519
I am familiar with AStar, I am confused, autotiles have this whole Navigation tab setup for you to cover the layers. There must be a way to get it working w/o using a different godot tool.
Hmmm I don't think you could dynamically alter the 'baked' navmesh/nav-path in run time, so imo navmesh/path is probably not the ideal way of planning path with dynamic tiles/environments.
- Best Answerset by Erich_L
MagickPanda
Hi Erich -- this took me longer than I hoped to understand as well.
Checking "Bake Navigation" does do something -- see the docs for TileMap.NavigationLayers
The navigation layers the TileMap generates its navigation regions in.
So, the tilemap is baking those layers automatically into the selected navigation layers.
you could then use NavigationServer2D GetMapPath to calculate a path between two point on the nav layer that has the baked content
https://docs.godotengine.org/en/latest/classes/class_navigationserver2d.html#class-navigationserver2d-method-map-get-path
so in c# if I had a script on a character player I could (after at least one physics frame) get a path between the character's current position and 0,0
var path = Navigation2DServer.MapGetPath(GetWorld2d().NavigationMap, GlobalPosition, new Vector2(), false, 1);
hope this helps!
Thanks for the info, I will take a look at naviserver2D.