Alternately, couldn't you just store the player's depth as part of the player state? They either are on layer 1 or layer 2 or whatever. Of course, then you still probably need some sort of trigger when the player walks up a hill so yeah.
As for exactly how to do it, we did have a very lengthy discussion about the technical details a while back. To be honest I can't remember the solution off the top of my head but I'm pretty sure we came up with something that works.
It probably needs to be revisited at some point. Even if it's just to make a better demo / documentation.