sphere pushing through wall

I am pushing a sphere with a kinematic cube that follows the mouse. Every once in a while the sphere hits a wall (made from a cube primitive) and gets pushed through it. Is there any way to prevent the sphere from going through the wall when pushed by a kinematic object?

Perhaps not what you’re looking for, but have you considered making the cube a non-kinematic object?

There are various pros and cons to that option. On the pro side, interactions between your cube and the rest of the scene will be more consistent. However, you will need to stop setting the cube position directly and instead work with forces (or directly modify velocity) to move the cube towards the mouse location.