How do I show an object falling inside another transparent object?

I created a transparent container and want to show the objects collected inside the container. I want to displace the collectible object from the original location but I do not want to make the object disappear. For example, a fruit falls from a tree into a glass container. Will attaching colliders to either or both objects work?

First, attach a rigidbody to the “fruit”, so that it falls and collides in a realistic fashion, and add a collider (I’d suggest CircleCollider2D for fruit? A Polygon Collider 2D would give you a more realistic bounce, but be careful if you have too many objects on the screen).

Next, for your “glass jar”, I’d suggest using the Edge Collider 2D, and trace a general U shape from one side of the jars mouth down and around to the other side of the jars mouth.

And there you have it.

If you are moving the glass jar around to simulate catching fruit falling from a tree, use rigidBody.AddForce(), or something similar, on the glass jar and the “fruit” inside the jar will be carried around your scene.