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

in Engine by (44 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.

by (20,923 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.
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 webmaster@godotengine.org with your username.