Why is the function "_on_body_entered" not working?

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

I was working on a project when I realised that the function on body entered didn’t work. So i created a new project to test what was wrong but I couldn’t fix the problem. I created 2 RigidBody2D nodes and each of them contained a Sprite node and a CollisionShape2D node. Can someone tell me what causes the function to not work?

The script I attached to one of the RigidBody2D nodes:

extends RigidBody2D


func _on_RigidBody2D2_body_entered(body):
	print("collision")

enter image description here

:bust_in_silhouette: Reply From: kidscancode

Did you connect the signal?

If you did you read the tip that shows when you connect the signal:

Emitted when a body enters into contact with this one. contact_monitor must be true and contacts_reported greater than 0.

Thanks a lot! That fixed the problem.

rubendw03 | 2020-03-20 18:40