How can I consolidate individual Tile collision shapes into large collision polygons from a TileMap?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Meowsolini

I have a TileMap node named CollisionTileMap. Each of the 21 Tiles in the TileMap’s TileSet has a different shape (1 is square, some are triangular, and some are a mix of both).

Instead of having a different collision shape at each cell where I place a Tile, I want to merge each of these individual shapes with each other to form consolidated collision polygons.

that would be amazing and would solve collision problems at the tile edges.

collisionshaped | 2022-04-23 18:01

:bust_in_silhouette: Reply From: afk_mario

Ended up implementing it using the Geometry class to support multiple polygons and I think even holes are generated correctly.

Polygons generated from tilemap

This post goes into more detail on how it works.

Another post that helped me:

https://forum.godotengine.org/30006/build-a-collision-polygon-from-tilemap-outline
answered 2 minutes ago by afk_mario (22 points)