Skip to content

Commit 803931e

Browse files
author
David Kline (ANALOG)
committed
update SetTrackingSpace per PM review
1 parent 18ea284 commit 803931e

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

Assets/MixedRealityToolkit/_Core/Boundary/MixedRealityBoundarySystem.cs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Microsoft.MixedReality.Toolkit.Internal.Definitions;
55
using Microsoft.MixedReality.Toolkit.Internal.Definitions.Utilities;
66
using Microsoft.MixedReality.Toolkit.Internal.Interfaces;
7+
using System;
78
using System.Collections.Generic;
89
using UnityEngine;
910
using UnityEngine.Experimental.XR;
@@ -99,9 +100,29 @@ private void CalculateBoundaryBounds()
99100
/// </summary>
100101
private void SetTrackingSpace()
101102
{
102-
// In current versions of Unity, there are two types of tracking spaces. For boundaries, everything other
103-
// than ExpereinceScale.Room currently maps to TrackingSpaceType.Stationary.
104-
TrackingSpaceType trackingSpace = (Scale == ExperienceScale.Room) ? TrackingSpaceType.RoomScale : TrackingSpaceType.Stationary;
103+
TrackingSpaceType trackingSpace;
104+
105+
// In current versions of Unity, there are two types of tracking spaces. For boundaries, if the scale
106+
// is not Room or Standing, it currently maps to TrackingSpaceType.Stationary.
107+
switch (Scale)
108+
{
109+
case ExperienceScale.Standing:
110+
case ExperienceScale.Room:
111+
trackingSpace = TrackingSpaceType.RoomScale;
112+
break;
113+
114+
case ExperienceScale.OrientationOnly:
115+
case ExperienceScale.Seated:
116+
case ExperienceScale.World:
117+
trackingSpace = TrackingSpaceType.Stationary;
118+
break;
119+
120+
default:
121+
trackingSpace = TrackingSpaceType.Stationary;
122+
Debug.LogWarning("Unknown / unsupported ExperienceScale. Defaulting to Stationary tracking space.");
123+
break;
124+
}
125+
105126
XRDevice.SetTrackingSpaceType(trackingSpace);
106127
}
107128

0 commit comments

Comments
 (0)