public void rotateToFaceCamera ( final GVRTransform transform ) { //see http://stackoverflow.com/questions/5782658/extracting-yaw-from-a-quaternion final GVRTransform t = getMainCameraRig ( ) . getHeadTransform ( ) ; final Quaternionf q = new Quaternionf ( 0 , t . getRotationY ( ) , 0 , t . getRotationW ( ) ) . normalize ( ) ; transform . rotateWithPivot ( q . w , q . x , q . y , q . z , 0 , 0 , 0 ) ; }
Apply the necessary rotation to the transform so that it is in front of the camera .