Bullet, player collsion and proper use of layers help

Godot Version

Godot 4.2


Hi! I am currently making a side-scrolling platformer/shooter. The player has an arm which rotates to face the mouse and shoots a bullet, which is a Rigidbody2D It launches, it flies, it’s great… except when I need to shoot downwards. Because the arm is only so long, the bullet spawns in the players collision. I THOUGHT this would be fine as I put the players collision on layer 3 and set the bullet to mask layers 1 and 2, being on layer 2 itself The contact monitor is enabled using cast ray and checking for 1 max contacts. Any advice or tools I’m missing?

If your player is in layer 2 and your bullet has mask layers 1 and 2, it will colide with the player. You would need to remove mask layer 2 from the bullet. For collision, layers are what the object is, while mask layers are everything they can colide.

Sorry, mistyped, meant to say the player is on layer 3, hence the confusion. edited that. My bad.

I see. Just confirm with what the bullet is colliding. If player is in layer 3, it shouldn’t be colliding with the bullet, it must be colliding with something else. You can print the body or area, depending which signal are you using to detect collision.