Sphere falls through cube-walls


I read a lot about objects falling through other objects in other threads, but I still couldn't figure out, what I'm doing wrong. So what do I want to do? I have a cube, which is built out of six walls, which are designed in Maya. The walls may have holes in them (but not every wall has a hole). In the middle of the cube, there is a sphere. You can rotate the cube however you want, and the sphere should roll around in the cube.

Now the problem is, every now and then, the sphere just falls through a wall.

The walls have mesh colliders and the sphere has a sphere collider. I tried lot of different settings, changing time, using smooth and convex option, even tried a script I found in here (DontGoThroughThings or something like that), but nothing worked.

Do you have any ideas what I can do about it?

Regards, Benji

For debugging measures, try adding a box collider around your walls your self, instead of the one that Unity gives when you import a model. See if that makes any difference.

It is not a problem of the unity mesh colliders, because even with box colliders the same problem occurs.

I guess I found the root of the problem: The rotation of the cube is obtained by a marker cube (physical cube with 6 markers as walls) which is rotated in front of the webcam. So the cube in unity rotates as the cube in my hands.

The rotation is currently set by cube.transform.rotation = physicalcuberotation . What I suspect is when the rotation between two timesteps is too big, the ball just cannot follow and is then outside the cube. So if I rotate the cube in my hands to fast, the markers cannot be tracked for a short while and the difference in the adjacent rotation values is to big.

Does that make any sense to you?

I will try to smoothen the rotation somehow and see if that helps.

trying to slow down the rotation does not really help as the rotation has to be the correct one at the end of the execution of update().

and again the ball is simply outside the cube, it seems that it is simply diffusing through the wall and their colliders.

any more suggestions what to try?

regards, benji