I have 2 scenes:
- Is a KinematicBody2D with layer "BALL" and mask "WALL"
- Has CollisionShape2D.
- Is a StaticBody2D with layer "WALL" and no masks.
- Has a CollisionShape2D.
- Has an Area2D with no layers and mask "BALL" and same CollisionShape2D extents as the parent StaticBody2D (also they have the same transforms).
What I would like to achieve is that on contact with Ball, the Brick's StaticBody2D will collide, and the Brick's Area2D will emit "body_entered".
But with this setup, the signal doesn't get emitted - the ball just gets bounced back after the collision with StaticBody2D - Area2D gets ignored.
If I make the CollisionShape2D of Brick's StaticBody2D tiny bit smaller than that of Area2D, it works fine - ball collides and bounces back, and the signal from Brick's Area2D is handled.
Also if I manually trigger the Brick's OnHit() method from the Ball script side after the collision detection, it works.
But I would like to do it without extra code or changing the extents of the collision shape and am curious why it doesn't work - is it because the two collision shapes are identical and the StaticBody2D's has priority over the Area2D's?
This is the code for the brick:
public class Brick : StaticBody2D
public override void _Ready()
var area = GetNode<Area2D>("CollisionArea");
area.Connect("body_entered", this, nameof(OnHit));
public void OnHit(Node node)
And the Brick scene hierarchy: