How can I get the body_entered signal on a StaticBody2D without an Area2D? I know workarounds exits but what I want is a custom solution using PhysicsServer2D that makes it fire the body_entered signal and keep track of old bodies so it fires body_exited signal as well.

I've tried the #4 method mentioned in this question that uses PhysicsServer2D but it seems not to work anymore. Since I want a native solution to add these signals on a StaticBody2D rather than relying on adding Area2D which requires maintaining 2 collision shapes.

Here's a section from the docs that caught my attention:

"Note: This callback is currently not called in Godot Physics."

  • \$\begingroup\$ What other question are you referring to? \$\endgroup\$
    – Pikalek
    Commented Jan 31 at 13:50
  • \$\begingroup\$ this one -> Equivalent of RigidBody2D's body_exited on StaticBody2D? \$\endgroup\$ Commented Jan 31 at 14:14
  • \$\begingroup\$ I've edited to include that info directly into the question. The other question lists 4 alternative solutions - it's not clear which you've tried, what you expected to get & how it differed from the outcome. It might also to describe your overall goal. I would try adding an Area2D as a child & signal up as needed (solution #3 in linked post). Can you edit to elaborate on why that option doesn't fit your situation ? \$\endgroup\$
    – Pikalek
    Commented Jan 31 at 14:53
  • \$\begingroup\$ thanks, that's so nice of you. I meant the #4 one which uses the PhysicsServer2D \$\endgroup\$ Commented Jan 31 at 15:57
  • \$\begingroup\$ I see, yes, that solution does not appear to work. Is there any reason you want to avoid an area for this? In particular, it could be possible to add an area using the physics server instead of a node, would that suffice? \$\endgroup\$
    – Theraot
    Commented Feb 1 at 12:19


You must log in to answer this question.

Browse other questions tagged .