Topic was automatically imported from the old Question2Answer platform.
Asked By
GrandNecro
I’m running into a bug where two CollisionShape2D are sticking to each others.
However, this only occurs when one collisionshape1 touches the buttom side of collisionshape2 – this does not happen on the side or when the shape1 touches the top side of shape2. I can’t understand why it only happens from the bottom side but not any other side.
The positions of the player node is sync using the new MultiplayerSynchronizer. The code for movement is minimalist. The scene tree is also nothing special
I figured it out so I’m gonna answer my own question.
Instead of using move_and_slide(), I replaced it with move_and_collide(velocity * delta).
move_and_slide seems to have some internal vector calculation that doesn’t work very well with top-bottom 2d game. It seems like it’s more suited for 2d platform game.
God bless, got the same problem. I think it’s an actual bug because my two circle colliders got stuck only when ‘enemy’ collider approached from up top, left/right/bottom approach collided fine.
Hi all, I realise this is an old post but I found that this was due to “Moving Platform” floor layers being enabled in the “CharacterBody2D” node of a scene.
If you click on the CharacterBody2D node, you can see in the inspector there’s a dropdown menu called “Moving Platform”. Open this and you can disable all the “Floor Layers”. Ensure to expand the layers so you can see and disable all 32 of them!
This option seems to exist to allow smooth movement on moving platforms so the physics doesn’t get all jittery. However, it causes scenes containing CharacterBody2D nodes to stick together from above.
While I haven’t tried it, it’s also possible that changing the “On Leave” value to “Do Nothing” may solve the problem too.
A simpler change sufficed for me, that is changing that sticky CharacterBody2D’s Motion Mode to Floating. Thanks to you though, I’d scratch my head forever if not for your reply!