Collision confusion: 2 objects collide despite of layers not being in each other masks

Godot Version

4.2

Question

Hello everyone!
I’m following this guide and currently I’m on stage of creating crates, which starts at 09:25:00 - I’m trying to create a container that will drop(spawn on top of itself) an item orb, collectable (hence collidible) by player. Orbs spawn upon container and move from it.

Container is a StaticBody2D, layer 3, masks 1,2,4.
Orb is an Area2D, layer 5, mask 1
Player is on layer 1, with masks 1,2,3,4,5

Issue is that my item orbs collide with containers immediately as they spawn.
There is a print in _on_body_entered method of an orb, logging body parameter.

I don’t understand why do they interact - they don’t have each others layers numbers in masks. Is there any known issues with 4.2?

How do they interact with each other? Do you spawn the orb when the when the player touches the Container? Can you screenshot your scene tree?

I spawn an orb upon shooting a container with projectile. Here’s a link to a whole project on google drive.
Projectile is an Area2D, layer 4, masks 1,2,3, which moves and collides with crate via _on_body_entered(body). That method checks if body has a hit method and calls it if it has.

Container then emits a signal, which is connected to an _on_container_open method of level scene in _ready of the level via groups , and that method adds an example of item orb as a child to the level.

I found what the problem was

On the level scene, where I placed the container, it’s layers and masks were different from it’s parent container node (I used inheritance) for some reason. Maybe I’ve changed it and forgot, or changes applied to a parent node have issues to updating all the child nodes in all the other scenes.

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