@@ -43,16 +43,19 @@ protected override List<Vector3> GetBoundaryGeometry()
43
43
// Get the boundary geometry.
44
44
var boundaryGeometry = new List < Vector3 > ( 0 ) ;
45
45
46
- if ( ! XRSubsystemHelpers . InputSubsystem . TryGetBoundaryPoints ( boundaryGeometry ) || boundaryGeometry . Count == 0 )
46
+ if ( XRSubsystemHelpers . InputSubsystem ? . GetTrackingOriginMode ( ) != TrackingOriginModeFlags . Floor
47
+ || ! XRSubsystemHelpers . InputSubsystem . TryGetBoundaryPoints ( boundaryGeometry )
48
+ || boundaryGeometry . Count == 0 )
47
49
{
48
50
#if UNITY_2019_3_OR_NEWER
49
51
// If the "main" input subsystem doesn't have an available boundary, check the rest of them
50
52
SubsystemManager . GetInstances ( XRInputSubsystems ) ;
51
53
foreach ( XRInputSubsystem xrInputSubsystem in XRInputSubsystems )
52
54
{
53
- if ( xrInputSubsystem . running &&
54
- xrInputSubsystem . TryGetBoundaryPoints ( boundaryGeometry ) &&
55
- boundaryGeometry . Count > 0 )
55
+ if ( xrInputSubsystem . running
56
+ && xrInputSubsystem . GetTrackingOriginMode ( ) == TrackingOriginModeFlags . Floor
57
+ && xrInputSubsystem . TryGetBoundaryPoints ( boundaryGeometry )
58
+ && boundaryGeometry . Count > 0 )
56
59
{
57
60
break ;
58
61
}
@@ -91,8 +94,19 @@ protected override void SetTrackingSpace()
91
94
break ;
92
95
}
93
96
94
- if ( XRSubsystemHelpers . InputSubsystem != null && ! XRSubsystemHelpers . InputSubsystem . TrySetTrackingOriginMode ( trackingOriginMode ) )
97
+ if ( XRSubsystemHelpers . InputSubsystem == null || ! XRSubsystemHelpers . InputSubsystem . TrySetTrackingOriginMode ( trackingOriginMode ) )
95
98
{
99
+ #if UNITY_2019_3_OR_NEWER
100
+ // If the "main" input subsystem can't set the origin mode, check the rest of them
101
+ SubsystemManager . GetInstances ( XRInputSubsystems ) ;
102
+ foreach ( XRInputSubsystem xrInputSubsystem in XRInputSubsystems )
103
+ {
104
+ if ( xrInputSubsystem . running && xrInputSubsystem . TrySetTrackingOriginMode ( trackingOriginMode ) )
105
+ {
106
+ return ;
107
+ }
108
+ }
109
+ #endif // UNITY_2019_3_OR_NEWER
96
110
Debug . LogWarning ( "Tracking origin unable to be set." ) ;
97
111
}
98
112
}
0 commit comments