Turning a Tilemap layer into a static collision object (SOLVED)

Hello guys,

I don’t have a very pressing question but a solution to this problem is very welcomed.

I want to turn one layer from a given tilemap into a real static collision when running the game. So the tilemap layer would be the grounds, the walls…

Right now, I’m creating my static collision object boxes on the top of each level collection which is a lot because I have quite a big Tilemap.

So if you have a solution let me know. Thanks.

Regards,
Riad

Does it have to be a single layer? Can’t you use the tilemap as a collision shape just like normal?

1 Like

Yes, it looks like you just need a built-in tilemap collisions:

You have a Collision group and image for a Tilesource (you can use the same image here as above, so the collisions will match what you see in the tilesource):

When you do so, you can select the collision group (“ground”) abd select on the tilesource which tiles should be taken into account as “ground”:
Honeycam%202021-03-08%2010-36-05

And then you create your tilemap and when you use it in a collection add a Collision Object with group: “ground”, proper masks groups (like “hero”, “player”, “enemy” or so) and as a collision shape use the tilemap:

And I also have collision shape in one, separate layer :wink: I just use tiles marked as “ground” in the tilesource in that layer:

5 Likes

Thanks guys for the answers :slight_smile:

I didn’t know we have this feature! it seems obvious now that I’m seeing it…

@Pawel, thanks a million for the pointers, they were really of great help :+1:

3 Likes

Glad we helped! :wink: We are here of further assitance, of course! :wink: