private void OnNetConnected() { NetState = ConnectState.Connected; NRDebug.Log("OnNetConnected"); if (Player != null) { CreateNetObjRequest(Player); } StartCoroutine(HeartBeatFunc()); }
/// <summary> /// The Unity Update method. /// </summary> public void Update() { #if !UNITY_DEITOR // Check that motion tracking is tracking. if (NRFrame.SessionStatus != SessionState.Tracking) { 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) { NRDebug.Log("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); } }
private void OnNetClosed() { NetState = ConnectState.DisConnected; NRDebug.Log("OnNetClosed"); }