In the last part of the project, we add a feature that detects when you're looking at an object (the cube) and highlights it with a different color.
This is accomplished with the help of the
CardboardView interface method,
onNewFrame, which passes the current head transformation information.
Let's start with the most interesting part. We'll borrow the
isLookingAtObject method from Google's Treasure Hunt demo. It checks whether the user is looking at an object by calculating where the object is in the eye space and returns true if the user is looking at the object. Add the following code to
/** * Check if user is looking at object by calculating where the object is in eye-space. * * @return ...