TIlemap layer water physics help - Sidescroller

Godot Version

4.4.1

Question

Hi, I’m attempting to make a game where the character will swap controls and physics when entering water. So swim physics in water and roll physics on land. I’m having trouble finding a descent solution to getting the physics to change as well as allowing the character to detect they are in water so that they’d then change controls in their script and swim. Currently I have 2 tilemaplayers, one for land, and one for water.

I can kind of get the behaviour I want by making an area2d node but that’d be tedious with lots of separate water zones. I want to ideally use the tilemaplayer that is dedicated to water and have the player detect when they enter it as well as modifying gravity but I’m having a hard time figuring out how to contact those signals.
So, I’m just looking for advice on how I would make a tilemaplayer act as a signal to change character physics and controls, if possible. Or what would be a better alternative.

Video, showing my general set up

TileMapLayer has local_to_map() which you can use to check what cell a location (like, say, your character’s position) is over. When you have the map coords, you can use that to call get_cell_atlas_coords() or similar on the tilemaps to see if you’re over one or the other.

If you do that in _process() or _physics_process(), you can feed that into your character’s physics.