/** * When spatialProcessing is over, get the computed height and store it. * Notify that the height has been computed, and destroy the spatialMapping and spatialProcessing. */ private void Update() { // No update needed, if spatialProcessing is already destroyed. if (SpatialProcessing == null) { return; } // UNITY EDITOR if (Time.realtimeSinceStartup > 13) { floorProcessingIsReady = true; return; } // Store the graphHeight, notify being ready and destroy spatialMapping and spatialProcessing. var updatedYPosition = SpatialProcessing.GetComponent <SurfaceMeshesToPlanes>().FloorYPosition; if (updatedYPosition != floorYInitialValue) { GRAPH_HEIGHT = updatedYPosition; floorProcessingIsReady = true; // Deactivate SM and SP, to avoid nullpointer exceptions. SpatialMapping.GetComponent <SMDeactivator>().deactivate(); SpatialProcessing.GetComponent <SPDeactivator>().deactivate(); StopAllCoroutines(); } }
// Used to get the inital graph_height value. private void Start() { floorYInitialValue = SpatialProcessing.GetComponent <SurfaceMeshesToPlanes>().FloorYPosition; }