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.
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 ...