Characterbody2d Gets Stuck In Ceiling

Godot Version

4.1.3

Question

I’m making a platformer where the player is able to dash horizontally. When they’re dashing, their hotbox is sideways so they can get through smaller spaces. When the player hits a wall, they stick to it, until the player jumps. When the player does that, they sometimes get stuck in the ceiling if the wall they dashed into was right under a ceiling. (I’m not sure if it’s relevant, so I’ll mention that I’m using a tile map with collisions for all walls, ceilings, and floors.)

I know that this is caused by the players collision shape rotating back to 0 degrees from 90 degrees, causing them to clip into the ceiling. Is there a way to avoid the player getting stuck like this?

Are you using move_and_slide()?

If so, the character shouldn’t be getting stuck, it should just pop out of the wall the next time move_and_slide() is called.

Can you give a bit more info as to how you’re moving the character and how the collisions are set up?