Why changing the motion mode solves the collision shapes sticking problem?

Godot Version

v4.2.2.stable.flathub [15073afe3]

Question

Hello people,
So I’ve been making a top-down survivors game. I have one enemy and a player, both having collision shapes. So when the collision occurs, the bodies are sticking together and when I move the player, the enemy moves with the player. Why does it happen?
I noticed that changing the motion mode to floating fixes the problem. From the docs, I learned that Floating mode makes sense for top-down games and Grounded makes sense for platformer games. But why?
Please explain why changing the motion mode solves the collision shapes sticking problem.

This thread helped me with changing the motion mode: What is causing my Collision2D to stick to each others?

1 Like

Godot runs totally different functions for each mode. the _move_and_slide_floating function is shorter and doesn’t including any snapping on floors.

Here’s a link to the source code for _move_and_slide_floating, the grounded edition is just above

1 Like