As I promised, here is the working demo (available from my webpage):
Download link

I was making it too complicated.. It's probably too complicated even now, but it's the simplest way I can think of right now.
I'll be really grateful if anyone will share his/her more elegant way of determining which side is facing upwards.



Best regards!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung