How to get collision shape of cell in TileMap?

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

How can I get the shape of a cell in a tilemap at a specific position? I can get the cell’s ID using GetCellv and the a shape using TileGetShape, but afaict TileGetShape requires the cell’s ID and the cell’s shape ID. Is there a way I can get the cell’s shape ID or smth to be able to get the shape or is there something I’m missing?

:bust_in_silhouette: Reply From: Pixel Puddle

You can use tile_get_shape_count (I’d assume it’s TileGetShapeCount in C#) to get the quantity of shapes, the “shape ID” is more of a shape index so you can use the quantity to retrieve any shapes belonging to a tile:

for shape_id in tile_get_shape_count():
    var shape = tile_get_shape(tile_id, shape_id)

In most cases though you probably just have one collision shape, so the “ID” (index) would just be 0.