Skip to content

Commit af37106

Browse files
author
David Kline (ANALOG)
committed
update gaze provider
1 parent 766245b commit af37106

File tree

5 files changed

+24
-7
lines changed

5 files changed

+24
-7
lines changed

Assets/MixedRealityToolkit.Services/InputSystem/GazeProvider.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ public bool Enabled
8686
/// <inheritdoc />
8787
public IMixedRealityInputSystem InputSystem { private get; set; }
8888

89+
/// <inheritdoc />
90+
public Transform Playspace { private get; set; }
91+
8992
/// <inheritdoc />
9093
public IMixedRealityInputSource GazeInputSource
9194
{
@@ -108,7 +111,7 @@ public IMixedRealityInputSource GazeInputSource
108111
private InternalGazePointer gazePointer = null;
109112

110113
/// <inheritdoc />
111-
public GameObject GazeCursorPrefab { get; set; }
114+
public GameObject GazeCursorPrefab { private get; set; }
112115

113116
/// <inheritdoc />
114117
public IMixedRealityCursor GazeCursor => GazePointer.BaseCursor;
@@ -413,8 +416,7 @@ private IMixedRealityPointer InitializeGazePointer()
413416
if ((GazeCursor == null) &&
414417
(GazeCursorPrefab != null))
415418
{
416-
// todo: update....
417-
GameObject cursor = Instantiate(GazeCursorPrefab, MixedRealityToolkit.Instance.MixedRealityPlayspace);
419+
GameObject cursor = Instantiate(GazeCursorPrefab, Playspace);
418420
SetGazeCursor(cursor);
419421
}
420422

Assets/MixedRealityToolkit.Services/InputSystem/MixedRealityInputSystem.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,16 @@ public class MixedRealityInputSystem : BaseCoreSystem, IMixedRealityInputSystem
2727
{
2828
public MixedRealityInputSystem(
2929
IMixedRealityServiceRegistrar registrar,
30-
MixedRealityInputSystemProfile profile) : base(registrar, profile) { }
30+
MixedRealityInputSystemProfile profile,
31+
Transform playspace) : base(registrar, profile)
32+
{
33+
Playspace = playspace;
34+
}
35+
36+
/// <summary>
37+
/// The transform of the playspace scene object.
38+
/// </summary>
39+
private Transform Playspace = null;
3140

3241
/// <inheritdoc />
3342
public event Action InputEnabled;
@@ -155,6 +164,7 @@ public override void Initialize()
155164
{
156165
GazeProvider = CameraCache.Main.gameObject.EnsureComponent(profile.PointerProfile.GazeProviderType.Type) as IMixedRealityGazeProvider;
157166
GazeProvider.InputSystem = this;
167+
GazeProvider.Playspace = Playspace;
158168
GazeProvider.GazeCursorPrefab = profile.PointerProfile.GazeCursorPrefab;
159169
}
160170
else

Assets/MixedRealityToolkit.Tests/InputSystem/TestFixture_03_InputSystemTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void Test01_CreateMixedRealityInputSystem()
3434
MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile = inputSystemProfile;
3535

3636
// Add Input System
37-
MixedRealityToolkit.Instance.RegisterService<IMixedRealityInputSystem>(new MixedRealityInputSystem(MixedRealityToolkit.Instance, MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile));
37+
MixedRealityToolkit.Instance.RegisterService<IMixedRealityInputSystem>(new MixedRealityInputSystem(MixedRealityToolkit.Instance, MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile, MixedRealityToolkit.Instance.MixedRealityPlayspace));
3838

3939
// Tests
4040
Assert.IsNotEmpty(MixedRealityToolkit.Instance.ActiveSystems);

Assets/MixedRealityToolkit/Interfaces/InputSystem/IMixedRealityGazeProvider.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ public interface IMixedRealityGazeProvider
2020
/// </summary>
2121
IMixedRealityInputSystem InputSystem { set; }
2222

23+
/// <summary>
24+
/// The transform of the Mixed Reality Playspace
25+
/// </summary>
26+
Transform Playspace { set; }
27+
2328
/// <summary>
2429
/// The Gaze Input Source for the provider.
2530
/// </summary>
@@ -33,7 +38,7 @@ public interface IMixedRealityGazeProvider
3338
/// <summary>
3439
/// The prefab to be instantiated as the gaze cursor.
3540
/// </summary>
36-
GameObject GazeCursorPrefab { get; set; }
41+
GameObject GazeCursorPrefab { set; }
3742

3843
/// <summary>
3944
/// The Gaze Cursor for the provider.

Assets/MixedRealityToolkit/Services/MixedRealityToolkit.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ private void InitializeServiceLocator()
363363
Utilities.Editor.InputMappingAxisUtility.CheckUnityInputManagerMappings(Definitions.Devices.ControllerMappingLibrary.UnityInputManagerAxes);
364364
#endif
365365

366-
object[] args = { this, ActiveProfile.InputSystemProfile };
366+
object[] args = { this, ActiveProfile.InputSystemProfile, Instance.MixedRealityPlayspace };
367367
if (!RegisterService<IMixedRealityInputSystem>(ActiveProfile.InputSystemType, args: args) || InputSystem == null)
368368
{
369369
Debug.LogError("Failed to start the Input System!");

0 commit comments

Comments
 (0)