How can you trap an object inside a box collision but player can walk through and in it?

If in doubt, please post the collision settings of the colliding elements.