Why doesn't my collision detection between two Area2D objects in Godot 4 work?

Click For Summary
The discussion focuses on detecting collisions between a circle and a floor in a script where the circle is falling. The initial setup appears correct, but the collision detection is not functioning as expected. Key points include the importance of understanding the tutorial material rather than following it blindly and the suggestion to verify if the '_on_body_entered' event is triggering before implementing additional collision code. This indicates a need for troubleshooting to identify the underlying issue with the collision detection.
Darkmisc
Messages
222
Reaction score
31
TL;DR
I've followed steps from a tutorial on how to set up collision detection between two Area2D objects. It's not working and I can't figure out why.
Hi everyone

I'd like to detect collisions between a circle and a floor.

I have set them up as follows:

1684196663869.png

1684196709419.png
1684196621540.png


1684196743781.png
The script runs fine (it's just a circle falling towards the floor), but nothing happens when the two objects collide.

Does anyone know what I've done wrong?Thanks
 
Technology news on Phys.org
Darkmisc said:
Does anyone know what I've done wrong?
Yes, (1) following a tutorial blindly without thinking and (2) giving up before you have tried to find the problem.

Before you add the 'if body.is_in_group' code you should test to see if the '_on_body_entered' event is firing.
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

Replies
1
Views
5K
Replies
10
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
21
Views
4K
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
3
Views
4K