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 are selected and highlights them. First, let's declare some variables at the top of the MainActivity
class. The selectedThumbnail
object holds the currently selected thumbnail index. We define border colors for normal and selected states:
final...