Detect if rigidbody is touching/colliding with another object.

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

I am trying to make a jump script where you cant jump again untill you collide with the ground or another object.
I’ve tried get_colliding_bodies(), tried using set_max_ocontects_reported(1) with it, I also tried func _on_Player_body_entered(body):
None of these have worked.
Is there anyway I can do this? Thanks in advance :slight_smile:

:bust_in_silhouette: Reply From: kidscancode

To enable contact reporting on a rigid body (2D or 3D), you must do the following:

  1. Enable contact_monitor.
  2. Set contacts_reported to a value > 0.
  3. Connect the body_entered signal.

If it’s still not working, then you have something else wrong in your setup.

Thanks :slight_smile:
The problem was I hadn’t enabled contact_monitor.

GoodClover | 2019-08-26 08:58