+1 vote

Hi everyone, so I am working on a game that requires modification of the tilemap in-game, indirectly. I'm placing StaticBodies into the screen (barricades and other items) and I need my AIs to be able to pathfind around them. I'm using a Navigation2D instance, with the TileMap and the StaticBodies added as children to that, and I've added NavigationPolygonInstances to the tiles in the tilemap using the new (Godot 3.1) TileSet editor. Right now, when you place a StaticBody into the scene (snapped to the map's grid, but not in the map), I replace the tile under it with a version of the same tile that doesn't have a NavigationPolygonInstance on it. This means that I have to have duplicate versions of every single floor tile, though, and it's really not great. Is there any way to dynamically access the TileMap's navigation mesh to modify it at runtime?

Thanks in advance for your help,
- Christopher

in Engine by (15 points)

I have the exact same problem, if anyone has a solution I'd be happy to hear it !

1 Answer

0 votes

I think replacing the tile is the only way at the moment. You could eventually mitigate the problem by having two tilemaps, one of them only holding navigation tiles, and the other for visuals. This could in turn be automated with a script so you could keep designing them all at once but separate them in a baking tool / at runtime.
Or you could make it so those tiles in particular are actually individual nodes?

by (28,884 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.