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