diff --git a/Assets/HoloToolkit/Boundary/Scripts/BoundaryManager.cs b/Assets/HoloToolkit/Boundary/Scripts/BoundaryManager.cs index a40415bb08d..2051dc2dd7d 100644 --- a/Assets/HoloToolkit/Boundary/Scripts/BoundaryManager.cs +++ b/Assets/HoloToolkit/Boundary/Scripts/BoundaryManager.cs @@ -105,33 +105,36 @@ private void RenderFloorQuad() { floorQuadInstance = Instantiate(FloorQuad); -#if UNITY_EDITOR - // So the floor quad does not occlude in editor testing, draw it lower. - floorQuadInstance.transform.localPosition = new Vector3(0, -3, 0); -#else - // Inside immersive headset draw floor quad at Y value of dimensions. - Vector3 dimensions; - // TODO: BUG: Unity: TryGetDimensions does not return true either. - //if (UnityEngine.Experimental.XR.Boundary.TryGetDimensions(out dimensions, - //UnityEngine.Experimental.XR.Boundary.Type.TrackedArea)) - if (UnityEngine.Experimental.XR.Boundary.TryGetDimensions(out dimensions, - UnityEngine.Experimental.XR.Boundary.Type.TrackedArea)) + if (!XRDevice.isPresent) { - Debug.Log("Got dimensions of tracked area."); - if (dimensions != null) - { - Debug.Log("Drawing floor at dimensions Y."); - // Draw the floor at boundary Y. - floorQuadInstance.transform.localPosition = new Vector3(0, dimensions.y, 0); - } + // So the floor quad does not occlude in editor testing, draw it lower. + floorQuadInstance.transform.localPosition = new Vector3(0, -3, 0); } else { - Debug.Log("Drawing floor at 0,0,0."); - // Draw the floor at 0,0,0. - floorQuadInstance.transform.localPosition = Vector3.zero; + // Inside immersive headset draw floor quad at Y value of dimensions. + Vector3 dimensions; + // TODO: BUG: Unity: TryGetDimensions does not return true either. + //if (UnityEngine.Experimental.XR.Boundary.TryGetDimensions(out dimensions, + //UnityEngine.Experimental.XR.Boundary.Type.TrackedArea)) + if (UnityEngine.Experimental.XR.Boundary.TryGetDimensions(out dimensions, + UnityEngine.Experimental.XR.Boundary.Type.TrackedArea)) + { + Debug.Log("Got dimensions of tracked area."); + if (dimensions != null) + { + Debug.Log("Drawing floor at dimensions Y."); + // Draw the floor at boundary Y. + floorQuadInstance.transform.localPosition = new Vector3(0, dimensions.y, 0); + } + } + else + { + Debug.Log("Drawing floor at 0,0,0."); + // Draw the floor at 0,0,0. + floorQuadInstance.transform.localPosition = Vector3.zero; + } } -#endif floorQuadInstance.SetActive(true); } }