O'Reilly logo

Cardboard VR Projects for Android by Matt Schoen, Jonathan Linowes

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Gaze to load

We want to detect when the user looks at a thumbnail and highlight the image by changing its border color. If users move their gaze away from the thumbnail, it will unhighlight. When the user clicks on the Cardboard trigger, that image is loaded.

Gaze-based highlights

Fortunately, we implemented the isLooking detection in the RenderBox library at the end of Chapter 5, RenderBox Engine. If you remember, the technique determines whether the user is looking at the plane by checking whether the vector between the camera and the plane position is the same as the camera's view direction, within a threshold of tolerance.

We can use this in MainActivity. We'll write a selectObject helper method that checks whether any of the objects in the scene ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required