I have a problem with collisions in my simple prototype when objects are fast moving

I have a problem with collisions in my prototype. I would like the balls, once they enter the box, not to fall out of the box when the box is moved fast. Unfortunately, when they enter and I move the box sideways, the balls pass through the box walls.

I move the box using physics, specifically playerRb.AddForce(forceStrength * horizontalInput, 0f, 0f).

My box consists of several objects:an Empty object (which has a Rigidbody component with Collision Detection set to Continuous Dynamic and a slightly smaller Box Collider, with the Is Trigger option enabled for counting the balls that enter the box), and 5 nested boxes that form the walls and floor of the box.

These 5 boxes are Cube objects with Box Colliders and the Is Kinematic option enabled (to prevent the box from falling apart). The balls that enter the box are simply Sphere objects with Sphere Colliders and Rigidbodies set to Collision Detection Continuous Dynamic.

I will provide the link to the WebGL build below. What am I doing wrong?

WebGL: WebGL Builds Box Counter

Unity Package: coutingprototype.unitypackage - Google Drive

Your walls have rigidbodies? You only need one rigidbody (in the empty parent transform). Then in child transforms you put your cube objects with box colliders but no rigidbodies.

I played around with your code. Not sure if this is the most efficient way however if you go into edit → project settings → time and change your Fixed Timestep to a lower number (Yours is at .02, I tried .005, there might be others that work). That fixed it for me using the code you provided.