Rigidbody should ignore child collider

I’m having some problems with the movement system for my character.
I have generic avatar setting with this bone transform hierarchy:

There is also an animator attached to the root object, which will animate the blue hierarchy.
All bones have just a box collider attached, so that projectiles can hit the character.
The movement rigidbody has this settings:

  • useGravity: true
  • isKinematic: false
  • constraints: freezed rotation

That settings can’t be changed to kinematic, because I need the “dynamic” behaviour of the rigidbody.

Now the problem: The moved bones from the animator will affect the root rigidbody. For example the walk cycle will move the character up and down, because the leg animation will push the leg into the ground.

I tried to put the rigidbody and the colliders on separate layers, but that didn’t fixed the problem.

How can I force the root rigidbody to ignore the colliders of the children?
I also can’t add a kinematic rigidbody to the child objects, because that will cause the root rigidbody to get crazy velocity and fly away…

I am grateful for any help!

You can use simple scripts for your main body with Movement Collider, and ignore collision with all of its children . Script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class UnityAnswers_IgnoreChildsCollision : MonoBehaviour {

    private Collider[] childrenColliders;

	void Start () {
        // adding all colliders to an array, but our collider will be added to !
        childrenColliders = GetComponentsInChildren<Collider>();
        foreach (Collider col in childrenColliders)
            // checking if it is our collider, then skip it, 
            if(col != GetComponent<Collider>())
                // if it is not our collider then ignore collision between our collider and childs collider
                Physics.IgnoreCollision(col, GetComponent<Collider>());

The only way I know of would be to separate your graphics and your control. Make the rigidbody a separate object from the collision/render mesh, and then have the collision/render object match the transform of the Rigidbody each frame.

I know this is old but it still comes up in google so I thought I’d answer - afaik this is the easiest way to have selective interaction in your game, as it’s a built in unity feature, doesn’t need any code, and doesn’t even take a minute to do (:

You can make things ignore each other by setting them to different layers, and having those layers ignore collisions with each other.

  • Click any item in Unity, then in the inspector click “Layers” (just underneath the name of the object, on the right) > “Add new layer”. Make a layer for your child objects (and your parent if you only want these colliders to ignore their parent, but still interact with other things).

  • Select all of the children you want the parent object to ignore, and in the inspector click Layers again, then select the new layer you made for the children. Do this with the parent too, setting it to be on your parent layer.

  • Next, go to Edit > Project Settings > Physics. At the bottom of that menu you’ll see a collision matrix. Find the check box where your parent and child layers intersect, and uncheck it.