Add "Collisions" enabling property for tilemaps layers, which allows to respect collision shapes regardless of visibility state #6405
Labels
feature request
A suggestion for a new feature
physics
Issues related to physics (2D and/or 3D)
tilemap
Issues related to tilemaps
Background topic on forum: https://forum.defold.com/t/tilemap-collisions-not-working-when-layer-is-invisible/64653
Problem:
When one is using two layers for game - one to represent collisions (often with basic shapes, like square or triangle) and one to represent visually the level (often with various shapes and edges), sometimes can happen, that visual representation layer is not covering the background collision layer, even if I set collision layer z under visual layer (mainly because of artistic vs practical aspects).
Problem is, that even if we make collisions on separate layer, we can not switch its visibility, because collision shapes are then not respected by physics engine.
Workaround:
To prevent this I can use different image(tilesource) for collision source and different for visual tiles. However for large maps/sources and in the development phase (when map can change a lot) this is cumbersome, as I always need to remember about eventually updating collision tilesource. Even though collision tiles are few, I can't make a smaller image for tilesource and reuse it for all visual representation, because the two tilesources (for collisions and visual representation) must have matching dimensions.
Idea:
One solution would be to allow to disable visibility of a layer (e.g. collision layer), without affecting collision shapes. For now there is only one property for visibility for tilemaps layers: Visible
It would be great to add another boolean property here for tilemaps layers called for example: "Collisions"
which if set to true, will tell physics engine to respect collision shape of the layer, regardless of property "Visible".
In this setup we could make a layer with collision shapes according to the tilesource, but the layer will not be visible in game ("Collisions": true, "Visible": false)
P.S. Another helping solution would be to allow tilesources of different sizes to be in tilemap for collisions (but row size must be identical, so order is maintained).
The text was updated successfully, but these errors were encountered: