Control a Virtual Camera with Your Gaze

For this final project in this chapter, we’ll implement an experimental and lesser-known method to interact with a 3D scene—using our gaze to rotate a constellation of planets containing Earth and the Moon. By looking at the scene displayed on our device screen from a specific angle, we can control the rotation of Earth and the Moon around the x- and y-axes, shown in the following screenshot. Similar to a scenario where we look around a fixed object by moving our head slightly sideways, we cause Earth to rotate and reveal the continents located on its sides accordingly.

images/ShapesObjects/Gaze.png

We’ll place Earth at the center ...

Get Rapid Android Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.