Method to find z-order of objects