0 votes

Using c#.

I have two rigidBody2Ds - one static and one rigid. I've hooked up the bodyentered 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 bodyentered 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.

Godot version 3.3
in Engine by (12 points)

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

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?

1 Answer

0 votes

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.

by (617 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.