/// <summary> Updates this object. </summary> public void Update() { #if !UNITY_EDITOR // Check that motion tracking is tracking. if (NRFrame.SessionStatus != SessionState.Running) { return; } #endif // Get updated augmented images for this frame. NRFrame.GetTrackables <NRTrackableImage>(m_TempTrackingImages, NRTrackableQueryFilter.New); // Create visualizers and anchors for updated augmented images that are tracking and do not previously // have a visualizer. Remove visualizers for stopped images. foreach (var image in m_TempTrackingImages) { TrackingImageVisualizer visualizer = null; m_Visualizers.TryGetValue(image.GetDataBaseIndex(), out visualizer); if (image.GetTrackingState() == TrackingState.Tracking && visualizer == null) { NRDebugger.Info("Create new TrackingImageVisualizer!"); // Create an anchor to ensure that NRSDK keeps tracking this augmented image. visualizer = (TrackingImageVisualizer)Instantiate(TrackingImageVisualizerPrefab, image.GetCenterPose().position, image.GetCenterPose().rotation); visualizer.Image = image; visualizer.transform.parent = transform; m_Visualizers.Add(image.GetDataBaseIndex(), visualizer); } else if (image.GetTrackingState() == TrackingState.Stopped && visualizer != null) { m_Visualizers.Remove(image.GetDataBaseIndex()); Destroy(visualizer.gameObject); } FitToScanOverlay.SetActive(false); } }
/// <summary> Executes the 'hmd lost tracking' action. </summary> private void OnHMDLostTracking() { NRDebugger.Info("[NRHMDPoseTracker] OnHMDLostTracking:" + NRFrame.LostTrackingReason); ShowTips(TipType.LostTracking); }
/// <summary> Executes the 'hmd pose ready' action. </summary> private void OnHMDPoseReady() { NRDebugger.Info("[NRHMDPoseTracker] OnHMDPoseReady"); ShowTips(TipType.None); }
/// <summary> Executes the 'stopped video capture mode' action. </summary> /// <param name="result"> The result.</param> void OnStoppedVideoCaptureMode(NRVideoCapture.VideoCaptureResult result) { NRDebugger.Info("Stopped Video Capture Mode!"); }
/// <summary> Executes the 'stopped recording video' action. </summary> /// <param name="result"> The result.</param> void OnStoppedRecordingVideo(NRVideoCapture.VideoCaptureResult result) { NRDebugger.Info("Stopped Recording Video!"); m_VideoCapture.StopVideoModeAsync(OnStoppedVideoCaptureMode); }
/// <summary> Executes the 'started recording video' action. </summary> /// <param name="result"> The result.</param> void OnStartedRecordingVideo(NRVideoCapture.VideoCaptureResult result) { NRDebugger.Info("Started Recording Video!"); }
/// <summary> Executes the 'started video capture mode' action. </summary> /// <param name="result"> The result.</param> void OnStartedVideoCaptureMode(NRVideoCapture.VideoCaptureResult result) { NRDebugger.Info("Started Video Capture Mode!"); m_VideoCapture.StartRecordingAsync(VideoSavePath, OnStartedRecordingVideo); }