Why is my stack of cubes vibrating, creeping, and penetrating?

I have a stack of cubes, resting on a horizontal bar. The bar is not kinematic, but constrained along all axis in code, and does not use gravity. The cubes use gravity, and are not kinematic. All objects use box colliders.

When I load the level, the stack of cubes vibrate and penetrate the horizontal bar. If I change the time fixed step from 0.01 to 0.003, they don’t penetrate anymore, but they still vibrate, and the whole stack creeps to the left, until eventually some cubes fall off.

alt text

Note, when the level starts, there is a slight space between the cubes. (They were initially stacked tightly, I put in the space to make sure they don’t penetrate from the get go.)

All objects have a physics material attached:

  • dynamic friction: 0.2
  • static friction: 0.6
  • bounciness: 0

Size of colliders: 0.83333 x 0.83333 x 1

Mass: 4

I want the stack to just keep still. What do I need to do to get it it stand still?

Things I have tried:

  • Increasing iteration count
  • Adding drag
  • Making the fixed time step even smaller
  • Increase the static friction (If I make it high enough, the creeping stops, but then the objects look like they are covered with valcro, and their behaviour with other physical objects look totally unnatural.)

OK, I figured it out.

The floor is not set to isKinematic. Instead, I constrain all six physics parameters (position and rotation) when the object starts. If I use isKinematic instead of the constraints, there is no shivering; no weird behaviour.

This is a far shot, but would it help reducing mass of the objects and making your kinematic floor object a simple static collider?

If you are looking for them to stay still until you interact with them, try setting their rigidbodies to sleeping.

Make sure your Physics Manager has proper sleep thresholds.

“is Kinematic” fixed it but did it fix the penetration issue?

I have a similar penetration issue, and suspect it should be rather straight forward solution. I believe it has to do with the center of the collider (look at the sample image, you can see the stacked cubes come to rest just at the tiny dot in the center of the table). This is exactly what is happening to my objects, except one single object (a ‘bowl’ that has similar mesh colliders to the rest of the objects on the table), with difference of a ‘character controller’ that I believe is making it stop at the surface of the table’s box collider.

I’ve tried fudging the table’s box collider setting the y scale to 0 (rendering it effectively flat) and that works nicely to stop the penetration, but unfortunately opens a new issue of allowing a different single object (a sphere) to fall penetrating the table entirely, straight through to the other side (which it does NOT do if I keep my table box collider set to scale of 1).

I could apply raycasting fix to the single fast moving/dropping sphere object, but all this starts to get very patchy IMHO. I’d rather fix the issue at the root cause if that’s even possible in UNITY.

Anyone got any ideas?

You may try to increase the mass of your object to reduce penetration issues. For my project we had a balloon with very low mass and it could move through everything when a force was applied to it. When we increased its mass by factor 10 it was not perfect but at least it stopped moving through every collider.

Maybe try to put each of the higher cubes als children of the lower cubes in the hirarchy:

-root

–lowestcube

—lowcube

----middlecube

-----highestcube

–nextcube

Set the parent on OnCollisionEnter(collider) event with this.transform.parent = collider.transform.

This should stop the shivering, though it may not always trigger as far as my experience says.