Detecting collision only between certain collisionShapes?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By JorensM

So basically I have two nodes: an Enemy node and a Player node.

The Enemy node has a collision shape, and the Player node has a collision shape for the body, as well as a collision shape for the attack.

What is currently happening is that when I enable the attack collision shapes, the collision resolutions acts as if the attack collision shape is part of the entire Player body, and when the Player approaches a solid object, instead of stopping where the Player body collision box is, it stops where the attack collision box is. But I need the attack collision box to detect when an enemy has been hit. So my question is, how do I make the game ignore the attack collision box when colliding with solid objects, but not ignore it when an enemy is being attacked.

:bust_in_silhouette: Reply From: JorensM

Found solution: Collision layers/masks

:bust_in_silhouette: Reply From: Wakatta

Set the attack to be on its own collision_layer and the solid’s mask to not interact with it.

More information here about collision_layers and masks