Rigidbody2D and non-trigger child colliders!

Hello!

I have a simple question with colliders and rigidbodies just for 2D. I have a character gameobject with a Rigidbody2D attached to it with a circle collider, this also has a child gameobject with an extra collider in the child which is not a trigger. Now considering that the character is always going to be moving around, must I have a Rigidbody2D also attached to the child colliders?

The reason I’m asking is because I’ve read around on the interwebs that if a “solid” collider does not have a Rigidbody attached to it Unity assumes this collider is static and does not move and therefore saves on performance. So does the fact that the parent collider has a Rigidbody automatically let Unity know that these other solid child colliders will also be moving around?

Any help will be really appreciated :smile:.

It doesn’t need a second rigidbody, unless it is moving in the parent object itself and should as well have physics calculations (For example a space ship with a human in it, that runs around and does stuff).

I like to encapsulate the colliders themselves in child objects for a cleaner structure. That especially helps, if you want to use more than one basic collider to approximate the shape of the gameobject. So in my case the more complex objects often look like this:

Player

  • Colliders
    – Head
    – Body
    – LeftArm
    – RightArm

(Player has the rigidbody)

Thanks for clearing that up! :smile: