Tilemap collisions not working when layer is invisible

#1

I found out, that when I uncheck “Visible” property of a layer of a tilemap it is not considered for collision shape anymore made from this tilemap.

I didn’t find any information about it, so I think this is a bug, because no “visibility” shouldn’t mean that I don’t want collision objects of those shapes.

Simple use-case - I made a level collisions layer, and a decorative level layer and I want only to display decorative layer, but use collisions from level collisions layer. I don’t want it to be in two different tilemaps, because it would complicate editing them. Separating it is useful, because I can create a regular shape (for ex. a 45 degree slope), but in decorative layer use some complicated grass, stairs or something like that, which shape is not good for a platformer character to move on smoothly.

I do not want collisions to be disabled like that, so another property “Collisions enabled for a layer” or something like that is needed.

In the following project you can check the Visible property of layer “collisions” marked and unmarked in tilemap.tilemap.

Empty Project.zip (97.6 KB)

0 Likes

#2

This is definitely up for debate. I would argue that if the layer isn’t visible then it should not interact with collision shapes.

You can differentiate between visuals and collisions shapes in the tilesource (https://defold.com/manuals/tilesource/#tile-source-collision-shapes)

1 Like

#3

Of course :wink:

This is the approach I’m currently using (one image used only for collision shape with color information, but another one used only for decorative layer with erased tiles that were used for collision) and while I agree that this workaround works, I can’t say that this is a convenient approach, because I need to have two images (and unfortunately they must be of the same size).

0 Likes