0 votes

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

asked Mar 20 in Engine by rubendw03 (41 points)

1 Answer

0 votes

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.

answered Mar 20 by kidscancode (16,432 points)

Thanks a lot! That fixed the problem.

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 How to use this Q&A? before posting your first questions.