#[4.1] How to do 2D tilemap navigation with agent radius

8 messages · Page 1 of 1 (latest)

frail olive
#

I'm using NavigationAgent2D to make my npc follow the player. The game uses a tilemap, navigation + physics layers are set up accordingly.

The problem is that the enemy gets stuck / slides along corners. Pathfinding should consider the radius of the enemy. The docs say

To change an actor's pathfinding radius bake NavigationMesh resources with a different NavigationMesh.agent_radius property and use different navigation maps for each actor size.

I don't know what to do with this information and can't find the right info online either. Could someone give me a pointer on how to do bake a navigation mesh for this case? I specifically really don't want to draw manually draw nav polygons, this stuff should be generated automatically somehow.

frail olive
#

i guess the answer is "wait for 4.2", because it will introduce nav mesh baking with an actor radius parameter for 2d. I've tested it, it's pretty much what I need

remote pine
#

@frail olive any solutions? I'm having the same issue :/

#

I tried on 4.2 and couldn't make it work though

frail olive
#

Nope, the solution for me is “wait”

When I tested it roughly three weeks ago, the nav mesh generation was a bit buggy for me still. Not 100% sure anymore, but I remember having to do something like this:

  • child the tilemap to the node that does the nav mesh baking
  • bake the nav mesh with the actor radius
  • not see any nav mesh bake result
  • rechild the tilemap to a different node
  • now see the nav mesh
wintry herald
#

The solution as mentioned is using the 4.2 navmesh baking. TileMap and tiles in general can not handle polygon based pathfinding, you have those corner and seam problems everywhere with the only solution is merging them, removing the tile-factor from the TileMap.

#

For the baking the TileMap does not have to be a direct child of the NavigationRegion2D to bake, the NavigationPolygon has an option to define a group name for the nodes that should be considered in the baking process. Only TileMap Layer0 will be baked.

molten drift