I have multiple rigidbody object floating away in the space. When they hit each other, they push away each. I want to destroy object if they hit something, but connect body_entered signal won't invoked when they impact each other:

func _ready():
    connect("body_entered", self, "destroy")

func destroy(body):

How do I check Rigidbody hit something?


By default, a RigidBody will not emit a signal when it collides with another RigidBody. This is usually a good thing, as RigidBodies may collide frequently, and could fire many signals that you don't care about, negatively impacting performance.

If you do care about detecting RigidBody collisions, you should set RigidBody.contact_monitor to true and RigidBody.contacts_reported to a value greater than 0.

From the docs on contact_monitor:

If true, the RigidBody will emit signals when it collides with another RigidBody.

| improve this answer | |
  • \$\begingroup\$ Thanks it works. \$\endgroup\$ – modernator Nov 11 '19 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.