I have previously done an app that detects the distance between the users face and the phone. It basically uses the distance between the user’s eyes to do so. The further the user is, the shorter the distance appers. It uses this formula:

Now, I made a simple 3d eye that follows your face. The 3d model is rendered using libgdx.

The link to the project on github