How to add Collision to the Tilemap?

Godot Version

4.3

Question

In my scene, I have a main character, enemies, and obstacles created using a tilemap. I followed a tutorial to create collisions for the tilemap, with its layer set to 2 and mask to 1. The main character has layer: 1 and mask: 2, while the enemies have layer: 2 and mask: 123. Currently, the main character and enemies can attack each other, and the obstacles can block the enemies, but the main character can pass through them from below. I tried setting the main character’s layer and mask to be exactly the same as the enemies’, but it didn’t work.