How to make Area2D use the collision shapes of a TilemapLayer?

Godot Version

4.3

Question

I would like to detect when the player enters or exits areas drawn using a Tilemap. While it is possible to achieve this by using CollisionShape2D together with Area2D, this would require additional work during editing.
Is it possible to use the collision shapes set in the TileSet as the collision shapes for an Area2D?

Define colision layer, for example 3 with name Areas
Create Area2D with needed shape “under” player node
Set Area2D Collision Mask to 3, Layer can be unset

In TileMapLayer’s TileSet add Physics layer with Layer 3

Draw this layer collision in tile set then use in TileMapLayer

Then back to Area2D and use signals body_entered/body_exited
When player enter to specific collision you got signal, but it argument - body will just TileMapLayer

No

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.