コード例 #1
0
 private void Update()
 {
     if (UseCardboardHeadTracker && CardboardManager.isCardboardViewOn)
     {
         Pose headPose = CardboardManager.GetHeadPose();
         CardboardHeadTracker.UpdatePose();
         transform.localPosition = headPose.position;
         transform.localRotation = headPose.rotation;
     }
 }
コード例 #2
0
        /// <summary>
        /// Gets the current head tracker pose
        /// If withUpdate is set to false, this method will return the pose from the last update
        /// </summary>
        /// <param name="withUpdate"></param>
        /// <returns></returns>
        public static Pose GetHeadPose(bool withUpdate = true)
        {
            if (withUpdate)
            {
                CardboardHeadTracker.UpdatePose();
            }

            headPoseTemp.position = CardboardHeadTracker.trackerUnityPosition;
            headPoseTemp.rotation = CardboardHeadTracker.trackerUnityRotation;

            return(headPoseTemp);
        }