I am trying to detect head movement for a Google Cardboard Android application. My device is a Nexus 5. I tried using the HeadTransform class (https://developers.google.com/cardboard/android/latest/reference/com/google/vrtoolkit/cardboard/HeadTransform), but the data from the getTranslation() method was useless (all zeros). I researched and found some mentions of a HeadTracker class (Google Cardboard VR sensors), but I was unable to find any documentation from Google. I managed to get the HeadTracker.getLastHeadView(Float[], int) to write into the provided array, but it gives me 16 elements. Because I can't find documentation, I don't know what any of the values represent. Does anyone know how to use this class?
Asked
Active
Viewed 752 times
1 Answers
0
Wow, I feel silly! After further thinking, the provided array is obviously a 4x4 matrix.

Jack DeLano
- 93
- 8
-
Did you get any good result for this? As i am looking to code a head track in android. – Youri Apr 06 '16 at 11:46
-
I was trying to make a camera preview compensate for head movement (so that the image would be steady). I applied the HeadTracker matrix to my OpenGL ES shader code, and, although it was doing something in response to how I moved my head, it wasn't what I wanted. I ended up analyzing the pixel data from the camera preview in order to detect how the user what moving their head. – Jack DeLano Apr 09 '16 at 15:54