Skip to content

Commit a0e11ce

Browse files
committed
Changed editor special casing to be headset present special casing
1 parent 5aab7e4 commit a0e11ce

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

Assets/HoloToolkit/Boundary/Scripts/BoundaryManager.cs

+25-22
Original file line numberDiff line numberDiff line change
@@ -105,33 +105,36 @@ private void RenderFloorQuad()
105105
{
106106
floorQuadInstance = Instantiate(FloorQuad);
107107

108-
#if UNITY_EDITOR
109-
// So the floor quad does not occlude in editor testing, draw it lower.
110-
floorQuadInstance.transform.localPosition = new Vector3(0, -3, 0);
111-
#else
112-
// Inside immersive headset draw floor quad at Y value of dimensions.
113-
Vector3 dimensions;
114-
// TODO: BUG: Unity: TryGetDimensions does not return true either.
115-
//if (UnityEngine.Experimental.XR.Boundary.TryGetDimensions(out dimensions,
116-
//UnityEngine.Experimental.XR.Boundary.Type.TrackedArea))
117-
if (UnityEngine.Experimental.XR.Boundary.TryGetDimensions(out dimensions,
118-
UnityEngine.Experimental.XR.Boundary.Type.TrackedArea))
108+
if (!XRDevice.isPresent)
119109
{
120-
Debug.Log("Got dimensions of tracked area.");
121-
if (dimensions != null)
122-
{
123-
Debug.Log("Drawing floor at dimensions Y.");
124-
// Draw the floor at boundary Y.
125-
floorQuadInstance.transform.localPosition = new Vector3(0, dimensions.y, 0);
126-
}
110+
// So the floor quad does not occlude in editor testing, draw it lower.
111+
floorQuadInstance.transform.localPosition = new Vector3(0, -3, 0);
127112
}
128113
else
129114
{
130-
Debug.Log("Drawing floor at 0,0,0.");
131-
// Draw the floor at 0,0,0.
132-
floorQuadInstance.transform.localPosition = Vector3.zero;
115+
// Inside immersive headset draw floor quad at Y value of dimensions.
116+
Vector3 dimensions;
117+
// TODO: BUG: Unity: TryGetDimensions does not return true either.
118+
//if (UnityEngine.Experimental.XR.Boundary.TryGetDimensions(out dimensions,
119+
//UnityEngine.Experimental.XR.Boundary.Type.TrackedArea))
120+
if (UnityEngine.Experimental.XR.Boundary.TryGetDimensions(out dimensions,
121+
UnityEngine.Experimental.XR.Boundary.Type.TrackedArea))
122+
{
123+
Debug.Log("Got dimensions of tracked area.");
124+
if (dimensions != null)
125+
{
126+
Debug.Log("Drawing floor at dimensions Y.");
127+
// Draw the floor at boundary Y.
128+
floorQuadInstance.transform.localPosition = new Vector3(0, dimensions.y, 0);
129+
}
130+
}
131+
else
132+
{
133+
Debug.Log("Drawing floor at 0,0,0.");
134+
// Draw the floor at 0,0,0.
135+
floorQuadInstance.transform.localPosition = Vector3.zero;
136+
}
133137
}
134-
#endif
135138
floorQuadInstance.SetActive(true);
136139
}
137140
}

0 commit comments

Comments
 (0)