0 votes

Dear people of the Godot QA, I have been trying to make a 2D platforming shooting game. I made my own gun preset scene, that way I wouldn't have to write different scripts for each gun. I made variables each with different names depending on collisions.

export (bool)var collideWithPlayer = false
export (bool)var collideWithEnemy = true
export (bool)var collideWithWorld = true

I made a scene for a pistol, then added the preset gun scene to the pistol scene. When I shot the gun, I noticed that even when I have collideWithPlayer set to false in the editor and the code, the player's hitbox still detects the bullets. The player's hitbox's mask is on bit 0, the enemy's mask is on bit 1, the world's(environment) mask is on bit 2, and the bullet's mask is on bit 3. I have bit mask 3 enabled on the bullet, and all layers disabled(They get enabled through code, which is set from the gun preset scene in the collideWith variables, which works just fine). I have the player's hitbox's mask set to bit 0 and the layers are set to all disabled except for bit 2(The world layer) and bit 3(The bullet layer). Even though the bullet's bit 0 layer is set to false(so it shouldn't collide with it), it still does, do you guys have any idea on why this is happening and/or how to fix it?
Thank you for your time!

Godot version 3.5
in Engine by (80 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.