TileMap Collision Layers and Masks Bug?

Godot v4.1, 2d

Replace this line with your Godot version

Question

So, I’m having trouble understanding why my sprite collides and doesn’t with the TileMap. When I set my tilemap to layer 3, mask 1, collision works. My sprite is on layer1, masking 1 and 5. Collision works because tile map mask is 1, sprite layer 1. Ok got it. I change tile map layer to anything else, suddenly collision doesn’t work. The mask for tilemap is still the same. Sprite layer, still the same. Why did the collision break? I have other collision boxes for the sprite but they don’t have 3 : mask or layer. I change the tilemap layer to, let’s say 6. And i change sprite mask to 6, or vice versa, (tilemap mask6, sprite layer 6) no collision! What am I missing?

Sprite’s don’t have a collision layer, maybe you are mixing up a visual layer, or you mean a CharacterBody2D.

I’d recommend having the sprite mask the tilemap’s layer 3, for the best results have both colliding parties mask each other’s layers, this way they both calculate collision against each other rather than being one-sided.

1 Like