Tilemap collisions not working when layer is invisible

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)

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)

2 Likes

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).

Bumping it up for a debate:

Many times visuals are different than collisions and, even if I set collision layer z under visual layer, it is sometimes visible: :confused:
image

Yet I don’t want to make more images for all the tilesources to prevent this as I described above. I know it’s not a priority issue, but maybe a quick solution is possible?
Maybe another property flag for tilemap layers:

Collisions: :ballot_box_with_check:

or something like that could solve this? As a way easier and faster way than two images to differentiate collisions and visuals in tilemaps?

Something like this:
collisions

5 Likes

+1

Is there an issue for this on GitHub? It doesn’t look like it:

In order for us to consider it in the future we need it as a feature request!

2 Likes

I will write down one for this idea :slight_smile:

EDIT: Added:

2 Likes