Area2D and RigidBody2D not colliding as expected

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

Good day all,

I have a minimal project with an arrow and a disc. The Disc is an Area2D, the Arrow a RigidBody2D.

The Arrow is triggered/fired upwards/towards the Disc by a button press, and should impact/collide with the Disc. The Disc should signal "hit" and a print should be logged.

This is not happening, and I’ve investigated and reconfigured the project to have the Node types swapped (Arrow as Area2D and Disc as RigidBody2D) with little to no difference.

The Disc’s on_body_entered(body) is never triggered.

I have two minimal representations of this issue, one with the Arrow as a child of main, the other with it instanced:

Any and all help will be greatly appreciated!

:bust_in_silhouette: Reply From: deaton64

I think it’s because you are moving the Rigidbody with code and you shouldn’t directly.
Maybe what you want your arrow to be is KinematicBody2D

have a look at this: USING KINEMATICBODY2D

You can see the collision detection work in your code by doing this:
Comment out translate(velocity * delta) in your script.
Place the arrow on top of the wheel in the 2D view and run the project.
You will get a collision.


Thanks, @deaton64! That was it!

I suspected it was because I’d made the Arrow the RigidBody2D, but nothing I tested fixed the problem for some reason. I must’ve missed this!

WizardNo.7 | 2021-06-24 06:48