-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
…ation RC2 Release
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,50 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using Microsoft.MixedReality.Toolkit.Diagnostics; | ||
using Microsoft.MixedReality.Toolkit.Utilities; | ||
using UnityEngine; | ||
|
||
namespace Microsoft.MixedReality.Toolkit.Examples.Demos | ||
{ | ||
public class DiagnosticsDemoControls : MonoBehaviour | ||
{ | ||
private async void Start() | ||
private IMixedRealityDiagnosticsSystem diagnosticsSystem = null; | ||
|
||
private IMixedRealityDiagnosticsSystem DiagnosticsSystem | ||
{ | ||
if (!MixedRealityToolkit.Instance.ActiveProfile.IsDiagnosticsSystemEnabled) | ||
get | ||
{ | ||
Debug.LogWarning("Diagnostics system is disabled. To run this demo, it needs to be enabled. Check your configuration settings."); | ||
return; | ||
if (diagnosticsSystem == null) | ||
{ | ||
MixedRealityServiceRegistry.TryGetService<IMixedRealityDiagnosticsSystem>(out diagnosticsSystem); | ||
} | ||
return diagnosticsSystem; | ||
} | ||
} | ||
|
||
await new WaitUntil(() => MixedRealityToolkit.DiagnosticsSystem != null); | ||
private async void Start() | ||
{ | ||
await new WaitUntil(() => DiagnosticsSystem != null); | ||
|
||
// Turn on the diagnostic visualizations for this demo. | ||
MixedRealityToolkit.DiagnosticsSystem.ShowDiagnostics = true; | ||
// Ensure the diagnostic visualizations are turned on. | ||
DiagnosticsSystem.ShowDiagnostics = true; | ||
} | ||
|
||
/// <summary> | ||
/// Shows or hides all enabled diagnostics. | ||
/// </summary> | ||
public void OnToggleDiagnostics() | ||
{ | ||
MixedRealityToolkit.DiagnosticsSystem.ShowDiagnostics = !MixedRealityToolkit.DiagnosticsSystem.ShowDiagnostics; | ||
DiagnosticsSystem.ShowDiagnostics = !DiagnosticsSystem.ShowDiagnostics; | ||
} | ||
|
||
/// <summary> | ||
/// Shows or hides the profiler display. | ||
/// </summary> | ||
public void OnToggleProfiler() | ||
{ | ||
MixedRealityToolkit.DiagnosticsSystem.ShowProfiler = !MixedRealityToolkit.DiagnosticsSystem.ShowProfiler; | ||
DiagnosticsSystem.ShowProfiler = !DiagnosticsSystem.ShowProfiler; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using Microsoft.MixedReality.Toolkit.Input; | ||
using UnityEngine; | ||
|
||
namespace Microsoft.MixedReality.Toolkit.Examples.Demos.EyeTracking | ||
{ | ||
/// <summary> | ||
/// Sample for allowing the game object that this script is attached to follow the user's eye gaze | ||
/// at a given distance of "DefaultDistanceInMeters". | ||
/// </summary> | ||
public class FollowEyeGazeGazeProvider : MonoBehaviour | ||
{ | ||
[Tooltip("Display the game object along the eye gaze ray at a default distance (in meters).")] | ||
[SerializeField] | ||
private float defaultDistanceInMeters = 2f; | ||
|
||
private IMixedRealityInputSystem inputSystem = null; | ||
|
||
/// <summary> | ||
/// The active instance of the input system. | ||
/// </summary> | ||
private IMixedRealityInputSystem InputSystem | ||
{ | ||
get | ||
{ | ||
if (inputSystem == null) | ||
{ | ||
MixedRealityServiceRegistry.TryGetService<IMixedRealityInputSystem>(out inputSystem); | ||
} | ||
return inputSystem; | ||
} | ||
} | ||
|
||
private void Update() | ||
{ | ||
if (InputSystem?.GazeProvider != null) | ||
{ | ||
gameObject.transform.position = InputSystem.GazeProvider.GazeOrigin + InputSystem.GazeProvider.GazeDirection.normalized * defaultDistanceInMeters; | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.