0 votes

I know that if you draw a polygon directly in a NavigationPolygonInstance within a Navigation2D, you can always draw "on top of it" to introduce a cutout polygon so that the intersection of those two polygons is not part of the NPI. Is it possible in any way to do this with TileMap navigation? I've gone through the steps below in order to experiment, but have not found a possible solution yet (not even a dirty one):

  • Place child TileMap beneath parent TileMap, with both having Navigation shapes defined.
  • Place sibling TileMap, also with Navigation shapes defined, underneath Navigation2D under which main NavigationPolygonInstance comes from Navigation Shapes.
  • Add an extra NavigationPolygonInstance to the Navigation2D, in addition to the TileMap(s), and place a polygon around things that are supposed to be cutout.
  • Same as previous, but instead add a small cutout of this Navigation shape; this provides a cutout for the manual NavigationPolygonInstance created, but does nothing about the Navigation2D's overall NavigationPolygon.
  • Used code to take the Navigation shape from a given tile in second TileMap that's meant to provide cutouts and insert that shape into the parent Navigation2D's NPI; it seems like this should work based on the engine code, but it seems like maybe it's not doing the intersection because it doesn't "look like an outline", although I could be mistaken on this.
  • Same as previous, but use a transform to translate the Navigation shape to where get_cellv returns from the second TileMap.
  • Finally, same as previous, except set the owner of the new Navigation shape to be the parent Navigation2D. I wasn't exactly sure what the owner needed to be here.

That's all I've tried but it seems like one of them should work intuitively, if any of them are going to work at all, so I'd appreciate any tips if you have them. My best guess at this point is the Navigation provided by TileMaps is basically useless if you need to merge two of them together, with one of them being a cutout of the other.

in Engine by (108 points)

Please log in or register to answer this question.

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 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 webmaster@godotengine.org with your username.