How to fix "sticking" entities

Godot Version

4.2 Mono


I don’t know how to explain it better than a video.
I tried options: I put that the mouse can collide with the player, but did not put that the player can collide with the mouse, thanks to this the player can walk safely and not get clamped by monsters. However, even this did not help, in that the player does not stick. Also put SafeMargin in 1 pixel, but did not help

I’ve had this problem when collision shapes overlap. If I remember right, I think they were trying to ‘slide’ against each other.

Well, that’s cool, did you solve the problem?

A minute passed and I realised.
Solution: Change the MotionMode of your CharacterBody2D entity from Grounded to Floating

Unfortunately, I only have a vague memory of the problem. I think I was working on a prototype and only did some ‘skin deep’ troubleshooting. I think I ended up just living with it since it was relatively rare.

If I remember right, you can still encounter the issue with Floating, Or, any time the collision shapes overlap for more than a physics frame. I think it was move_and_slide() is what ended up keeping them together. But, I’m just guessing at this point.

Sorry I can’t give a more definitive answer right now. I’m just hoping to help in some small way. :smiley:

1 Like

I think just a MoveAndCollide check should have been done before the step, and if there is a collision it will stop. Changing the MotionMode helped me, I don’t deny it’s the ultimate solution to the problem, but it doesn’t bother me now.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.