22// Licensed under the MIT License. See LICENSE in the project root for license information.
33
44using Microsoft . MixedReality . Toolkit . Core . EventDatum . Teleport ;
5+ using Microsoft . MixedReality . Toolkit . Core . Interfaces ;
56using Microsoft . MixedReality . Toolkit . Core . Interfaces . InputSystem ;
67using Microsoft . MixedReality . Toolkit . Core . Interfaces . TeleportSystem ;
78using Microsoft . MixedReality . Toolkit . Core . Services ;
@@ -14,8 +15,16 @@ namespace Microsoft.MixedReality.Toolkit.Services.Teleportation
1415 /// <summary>
1516 /// The Mixed Reality Toolkit's specific implementation of the <see cref="Microsoft.MixedReality.Toolkit.Core.Interfaces.TeleportSystem.IMixedRealityTeleportSystem"/>
1617 /// </summary>
17- public class MixedRealityTeleportSystem : BaseEventSystem , IMixedRealityTeleportSystem
18+ public class MixedRealityTeleportSystem : BaseCoreSystem , IMixedRealityTeleportSystem
1819 {
20+ public MixedRealityTeleportSystem (
21+ IMixedRealityServiceRegistrar registrar ,
22+ Transform playspace ) : base ( registrar , null ) // Teleport system does not use a profile
23+ {
24+ Playspace = playspace ;
25+ IsInputSystemEnabled = ( registrar . GetService < IMixedRealityInputSystem > ( showLogs : false ) != null ) ;
26+ }
27+
1928 private TeleportEventData teleportEventData ;
2029
2130 private bool isTeleporting = false ;
@@ -47,7 +56,7 @@ private void InitializeInternal()
4756
4857 if ( eventSystems . Length == 0 )
4958 {
50- if ( ! MixedRealityToolkit . Instance . ActiveProfile . IsInputSystemEnabled )
59+ if ( ! IsInputSystemEnabled )
5160 {
5261 eventSystemReference = new GameObject ( "Event System" ) ;
5362 eventSystemReference . AddComponent < EventSystem > ( ) ;
@@ -123,6 +132,16 @@ public override void Unregister(GameObject listener)
123132
124133 #region IMixedRealityTeleportSystem Implementation
125134
135+ /// <summary>
136+ /// The transform of the playspace scene object.
137+ /// </summary>
138+ private Transform Playspace = null ;
139+
140+ /// <summary>
141+ /// Is there an input system registered.
142+ /// </summary>
143+ private bool IsInputSystemEnabled = false ;
144+
126145 private float teleportDuration = 0.25f ;
127146
128147 /// <inheritdoc />
@@ -237,7 +256,7 @@ private void ProcessTeleportationRequest(TeleportEventData eventData)
237256 {
238257 isProcessingTeleportRequest = true ;
239258
240- var cameraParent = MixedRealityToolkit . Instance . MixedRealityPlayspace ;
259+ var cameraParent = Playspace ;
241260
242261 targetRotation = Vector3 . zero ;
243262 targetRotation . y = eventData . Pointer . PointerOrientation ;
0 commit comments