Is there a way to assign different collision layers to different collision shapes on the same PhysicsBody2D?

Godot Version



I have a CharacterBody2D with a collision shape. I’d like to add a different shape to interact with a different set of collision layers, is there a way to achieve something like this?

I originally tried adding a StaticBody2D as a child of the CharacterBody2D, but the collision shape for the child is not respected at all. Additionally the static and character body have none of the same layers. I’m not sure if this is a bug or I’m using it in an unintended way.

An Area2D node (with its own collision shape child node) that is the child of the Character2D node should accomplish what you’re looking for.

I ended up doing something with an area2D for now, but since I’m using this to detect “physics collisions” I was worried about using an area2d signal for this purpose.

Check out move_and_collide() , I have not used it myself, but I read that it can be a more reliable physics collision handler when it comes to changing states