collision-detectiongame-developmentgame-physicsgodot

How to implement one way collision for platforms in Godot?


I have a 2d platform game and wanted to make the player be able to jump on top of it from the bottom or diagonally from bottom-left or bottom-right. The problem I'm facing is that sometimes the player gets stopped when hitting the side of the platform.

In Godot, I've created a CollisionShape2D in the platform with One Way Collision enabled. I've used a circle shape for the player's CollisionShape2D but I think the problem lies somewhere else.

How can I disable the side collisions for platforms?


Solution

  • The problem was caused by circle collision and move_and_slide. Apparently, the circle triggered a move/slide but it slowed down the x velocity to almost 0 which looked like the player hit a side wall.

    enter image description here

    Changing the circle to rectangle has solved the issue.