Weird behaviour when adding collisionShape2D

Godot Version

v4.2.1.stable.official [b09f793f5]

Question

New to Godot. I’m trying to make a flappybird-like game as practice.
I’m encountering some strange behaviour however: when pressing space some up velocity is added, however, when the player object has a collisionShape2d (or polygon) the movement is like it’s bouncing on all kinds of invisible object. When removing the CollisionShape2D, the movement when pressing space is as expected.
See GitHub - Lhaaits/kittytoots-godot for the project. Run player.tscn and press space a couple times to reproduce the strange behaviour.
I’ve also added 2 screen recordings to the repo:
kittytoots-godot/blob/main/BugWithCollision.mov
kittytoots-godot/blob/main/WorkingWithoutCollision.mov
You can click download raw to the right to download them.
Does anyone know why adding the collisionShape is causing weird side effects?

In the Godot Editor, in the top menu you have:
Scene, Project, Debug, Editor, Help

Click Debug and select ‘Visible Collision Shapes’.

You should then be able to see what your collision shape is colliding with.

I suspect you are not moving the shape with your flappy bird, but you should easily be able to tell what is happening when the shapes visible.

Hope that helps,

Paul

1 Like

Omg, thanks for the tip! That helped me solve it! The collisionshapes from the balloons where falling instead of moving with the player, causing them to collide.

1 Like

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