|Attention||Topic was automatically imported from the old Question2Answer platform.|
|Asked By||Mr. Gamezz|
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!