• Godot Help2D
  • body_entered(body) signal not firing for static bodies?

Doing some testing currently on a very basic prototype and the _on_RigidBody2D_body_entered(body) signal is not firing when used on a static body when a rigid body collides with it?

Is this intentional? All works as expected if I change my static body scene into another rigid body, so I do think it is the static body parameter that is impacting me here.

How can I access the static body (body) that has been collided with in this instance? I am trying to give the player score based on the platform (static body) that they bounce off. Think pinball bumpers....

I'm new here so there will definitely be somebody along with a better answer but first of all Static Bodies are exactly that. Static. They participate in collision detection (things can bounce off) but they don't move in response (immovable object).

As such, they don't have a body_entered capability. However, the collision can be detected when Kinematic Bodies hit them when using move_and_collide or move_and_slide but obviously you're not firing a Kinematic Body at it.

One method would be to use a RigidBody2D (with a suitable collision shape added) instead of a Static but set the mode in the inspector to Kinematic. Make sure Contacts Reported is at least 2 and Contact Monitor is enabled. This way, it'll report the body entered but won't suddenly fly away when the other RigidBody2D collides with it. (Because Kinematic Bodies are moved by impulses).

For score/gameplay purposes, you can use an Area2D.