Simulate gravity in 2D with depth

Hello everyone!

I have poor experience in Unity so want to ask about help. I have a scene and it contains 3 sprites:

  • background (wall + floor)
  • table
  • apple

Apple can be dragged by mouse. And I wanna achieve the following things:

  • apple can be placed at any point of floor/table
  • if apple is dropped on wall/table’s door it should fall to a surface (floor/table)
    It might sounds confusing so I’ve attached a screenshot:
    https://ibb.co/xmJtx8Q

So I wanna ask about how to implement it more efficiently. Can I achieve it with only 2D things? Or I should use 3D objects/physics?
Sorry if I ask some basic things but I don’t know correct definition for such behavior. So I can’t find any related example…

You can definitely achieve such behaviour using 2D features. Here is a nice tutorial about drag & drop functionality

When you release the apple, you could check what type of objects is under your mouse cursor / finger. Then, depending on what’s there you could snap it to a table, drop to the floor etc.