How to walk in front of and behind collidable objects in Paper 2D

My brother-in-law and I are making an open world adventure game with the 2d engine. We have come up with collision/programming to allow a single object to be walked in front of and behind of like a tree, but the problem is that when we have a clump of blue printed trees they pop in and out. I know that this is based on their Y values and we have tried several different thing including having each tree in an area set at its own Y value and the character is considered in front of or behind based on object mid point. This is still have issues however and sometimes the objects just disappear, maybe because of camera value. We have been working on this one part about a month and haven’t found a solid answer. What is the best way to do this? Thank you.