Does changing a rigidBody2D's mode to static disable its collision signals such as BodyEntered? (C#)

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

Using c#.

I have two rigidBody2Ds - one static and one rigid. I’ve hooked up the body_entered signal on both and they hit each other in the scene once you start it. (I’ve turned on contact monitoring AND raised the contacts reported to 100 on BOTH so that is not the issue!). Only the rigidBody2D with mode rigid is firing the signal - if I change the static rigidBody2D to type rigid, its body_entered signal starts working again. What am I missing? How do I use body_entered signal on a static rigidBody2D? Does it have to be moving? Documentation said static mode makes the rigid behave like a staticBody2D which has no signals, is that why?

For those curious, use case was having an area to despawn rigidBody2D’s if they entered. Ended up using an area2D instead (which worked), but I’m curious as to why my initial idea of using a static rigidBody2D didn’t work. I couldn’t figure it out after looking at documentation.

Try using more bodies and see if the static one emits the signal on colliding with them.

magicalogic | 2021-05-01 13:54

I did, and I turned visible collision shapes on in the debugger. The static body does not fire body_entered on any of the bodies colliding with it. To be clear the static body is not moving, the rigid bodies are running into it. Is that why?

Ammo | 2021-05-01 23:37

:bust_in_silhouette: Reply From: MrEliptik

As you can see from the docs, StaticBody doesn’t have such signal.
https://docs.godotengine.org/fr/stable/classes/class_staticbody.html?highlight=staticbody

I would suggest using an Area or detecting collision from the other RigidBodies.