// Use for initialization. private void Start() { PhysicsRaycastMask = 1 << PhysicsLayer; remoteMeshTarget = FindObjectOfType <RemoteMeshTarget>(); #if !UNITY_EDITOR StartObserver(); #endif #if UNITY_EDITOR fileSurfaceObserver = GetComponent <FileSurfaceObserver>(); if (fileSurfaceObserver != null) { // In the Unity editor, try loading a saved mesh. fileSurfaceObserver.Load(fileSurfaceObserver.MeshFileName); if (fileSurfaceObserver.GetMeshFilters().Count > 0) { SetSpatialMappingSource(fileSurfaceObserver); } else if (remoteMeshTarget != null) { SetSpatialMappingSource(remoteMeshTarget); } } #endif }
/// <summary> /// Instructs the SurfaceObserver to start updating the SpatialMapping mesh. /// </summary> public void StartObserver() { #if !UNITY_EDITOR if (!IsObserverRunning()) { surfaceObserver.StartObserving(); StartTime = Time.time; } #elif UNITY_EDITOR fileSurfaceObserver = GetComponent <FileSurfaceObserver>(); if (fileSurfaceObserver != null) { // In the Unity editor, try loading a saved mesh. fileSurfaceObserver.Load(fileSurfaceObserver.MeshFileName); if (fileSurfaceObserver.GetMeshFilters().Count > 0) { SetSpatialMappingSource(fileSurfaceObserver); } else if (remoteMeshTarget != null) { SetSpatialMappingSource(remoteMeshTarget); } } #endif }