Help with ideas about changing state by what physics area you are in.

Godot 4.3 RC 3

Hello, first post, I am making a platformer where the character has a state of idle, walk, run, jump, swim with different physics of speed based on the type of physics area you are in or standing on.

For instance when they enter water I change the speed of movement, change the state of the character. Another example is if they are standing on ice on a tilemap layer then the friction will be less than normal ground.

I have setup physics layers in the tileset and assigned them correctly and I use a function to determine what physics to apply. However I am also using a tilemap layer for water. I don’t want collisions with water so I set that as a different collision layer. So I use the character position to see if I am touching a tile and that will give me custom tile data as to what physics I am using.

I then use the data for physics to change the state of the character. I don’t really like this approach since the physics data has to know what state to change to. The physics data should just changes the physics speed, friction, acceleration etc.

But then the character would have to know the physics changed and determine what state to change to.

Is there a cleaner way of doing this? I appreciate any help or ideas.