Search Unity

Rigidbody with many colliders has strange inertia

Discussion in 'Physics' started by the_mr_matt, May 11, 2020.

  1. the_mr_matt

    the_mr_matt

    Joined:
    Jul 21, 2015
    Posts:
    124
    I've had some feedback from my game that "gravity feels weird and moon-like". After some investigating I found that some of my objects do indeed behave as though they are on the moon. I can confirm the scale of these objects is correct -- the issue appears to be with the rigidbody itself.

    In the video below I have 4 BBQ's. All the BBQ's have the same rigidbody with mass 75kg, no interpolation and discrete collision detection.

    The BBQ's are setup as follows (by the red number above them):
    1. A single box collider around the whole mesh
    2. Many smaller child box colliders for detailed collision
    3. Many smaller child box colliders for detailed collision with COM and inertia tensor manually overridden to match BBQ #1
    4. Many smaller child box colliders for detailed collision but with a duplicated collider in the top half 30 times

    The results are:
    1. Natural motion, "normal" gravity
    2. Unexpected, gravity can feel very slow at times
    3. Closer to BBQ #1 but still not perfect
    4. Exaggerated effect but clearly gravity (inertia) does not feel normal



    From this I would draw the conclusion that the more child colliders I have, the less reliable the collision is and the worse the generated inertia tensor is.

    (cross posted on Stack Exchange)
     
    Last edited: May 11, 2020
  2. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
    The problem is that by default the inertia tensor is computed using the volume of the coliders and assuming uniform density. Therefore, the parts that should be less massive do the same contribution to the inertia than the massive parts. Only the volume counts.

    It's not an issue per-se, it's just how the engine works. As the inertia tensor parameters are exposed, you could use some CAD program to compute the inertia (or calculate it yourself) and then configure the rigidbody with it.
     
    Last edited: May 12, 2020
  3. the_mr_matt

    the_mr_matt

    Joined:
    Jul 21, 2015
    Posts:
    124
    Yes well that's what I have attempted by approximating the whole mesh with a single box collider and copying the inertia tensor values. It's obviously not great but it's a workaround.
     
    Edy likes this.