0 votes

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:
enter image description here

enter image description here

Godot version 3.6
in Engine by (16 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.