7
7
using System . IO ;
8
8
using System . Linq ;
9
9
using UnityEngine . EventSystems ;
10
+ using HoloToolkit . Unity . InputModule ;
10
11
11
12
#if UNITY_2017_2_OR_NEWER
12
13
using UnityEngine . XR . WSA . Input ;
13
14
#else
14
15
using UnityEngine . VR . WSA . Input ;
15
16
#endif
16
17
17
- #if UNITY_5_3 || UNITY_5_3_OR_NEWER
18
- using UnityEngine . SceneManagement ;
19
- #endif
20
18
using OpenCVForUnity ;
21
19
22
20
namespace HoloLensWithOpenCVForUnityExample
@@ -30,7 +28,7 @@ namespace HoloLensWithOpenCVForUnityExample
30
28
/// https://docs.opencv.org/3.4.0/d7/d21/tutorial_interactive_calibration.html
31
29
/// </summary>
32
30
[ RequireComponent ( typeof ( HololensCameraStreamToMatHelper ) ) ]
33
- public class HoloLensArUcoCameraCalibrationExample : MonoBehaviour
31
+ public class HoloLensArUcoCameraCalibrationExample : ExampleSceneBase
34
32
{
35
33
/// <summary>
36
34
/// The preview quad.
@@ -207,6 +205,10 @@ public class HoloLensArUcoCameraCalibrationExample : MonoBehaviour
207
205
// Use this for initialization
208
206
IEnumerator Start ( )
209
207
{
208
+ camera = FindObjectOfType < HoloToolkit . Unity . InputModule . MixedRealityCameraManager > ( ) ;
209
+ cursor = FindObjectOfType < HoloToolkit . Unity . InputModule . Cursor > ( ) ;
210
+ input = FindObjectOfType < HoloToolkit . Unity . InputModule . InputManager > ( ) ;
211
+
210
212
webCamTextureToMatHelper = gameObject . GetComponent < HololensCameraStreamToMatHelper > ( ) ;
211
213
212
214
// fix the screen orientation.
@@ -897,11 +899,7 @@ void OnDestroy ()
897
899
/// </summary>
898
900
public void OnBackButtonClick ( )
899
901
{
900
- #if UNITY_5_3 || UNITY_5_3_OR_NEWER
901
- SceneManager . LoadScene ( "HoloLensWithOpenCVForUnityExample" ) ;
902
- #else
903
- Application . LoadLevel ( "HoloLensWithOpenCVForUnityExample" ) ;
904
- #endif
902
+ LoadScene ( "HoloLensWithOpenCVForUnityExample" ) ;
905
903
}
906
904
907
905
/// <summary>
@@ -1128,8 +1126,10 @@ private void OnTappedEvent (TappedEventArgs args)
1128
1126
private void OnTappedEvent ( InteractionSourceKind source , int tapCount , Ray headRay )
1129
1127
#endif
1130
1128
{
1131
- if ( EventSystem . current . IsPointerOverGameObject ( ) )
1129
+ // Determine if a Gaze pointer is over a GUI.
1130
+ if ( GazeManager . Instance . HitObject != null && GazeManager . Instance . HitObject . transform . name == "Text" ) {
1132
1131
return ;
1132
+ }
1133
1133
1134
1134
OnCaptureButtonClick ( ) ;
1135
1135
}
0 commit comments