Skip to content

Commit

Permalink
Changed editor special casing to be headset present special casing
Browse files Browse the repository at this point in the history
  • Loading branch information
keveleigh committed Sep 21, 2017
1 parent 5aab7e4 commit a0e11ce
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions Assets/HoloToolkit/Boundary/Scripts/BoundaryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit a0e11ce

Please sign in to comment.