Convert Tilemap or grid into Polygon

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

I basically want to pass in get_used_cells(), and get back a polygon that encompasses the whole tilemap.

I tried converting each cell in a tilemap into a small 32x32 polygon. Then I merged all of them one by one using Geometry.merge_polygon(). But that has a weird effect, where the left most tile acts as a height limit, and the polygon does not reach above that point. Otherwise this would work great.