Ejemplo n.º 1
0
        public override void Disable()
        {
#if PLATFORM_LUMIN
            if (MLControllerCallbacksActive)
            {
                RemoveAllControllerDevices();
                MLInput.OnControllerConnected    -= MLControllerConnected;
                MLInput.OnControllerDisconnected -= MLControllerDisconnected;
                MLInput.Stop();

                MLControllerCallbacksActive = false;
            }

            if (MLHandTrackingActive)
            {
                RemoveAllHandDevices();
                MLHandTracking.Stop();

                MLHandTrackingActive = true;
            }

            if (Instance == this)
            {
                Instance = null;
            }
#endif
        }
 private void OnDestroy()
 {
     //turn off hand tracking:
     if (MLHandTracking.IsStarted)
     {
         MLHandTracking.Stop();
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Stops MLHandTracking if it has been started.
 /// </summary>
 public static void Stop()
 {
     #if PLATFORM_LUMIN
     if (MLHandTracking.IsStarted)
     {
         MLHandTracking.Stop();
     }
     #endif
 }
        private void StopMLInput()
        {
            RemoveAllHandDevices();

            //turn off hand tracking:
            if (MLHandTracking.IsStarted)
            {
                MLHandTracking.Stop();
            }
            IsReady = false;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Starts up MLHandTracking.
        /// </summary>
        /// <param name="initializeValues">Bool that determines if MLHandTracking should automatically run with all poses and high filter levels.</param>
        public static MLResult Start(bool initializeValues = false)
        {
            #if PLATFORM_LUMIN
            MLResult _result = MLHandTracking.Start();
            if (!_result.IsOk)
            {
                Debug.LogErrorFormat("Error: MLHandTrackingStarterKit failed starting MLHandTracking. Reason: {0}", _result);
            }

            if (initializeValues)
            {
                bool success = false;

                success = EnableKeyPoses();
                if (!success)
                {
                    MLHandTracking.Stop();
                    _result = MLResult.Create(MLResult.Code.UnspecifiedFailure, "MLHandTrackingStarterKit failed to start correctly because MLHandTrackingStarterKit.EnablePoses failed because MLHandTracking.KeyPoseManager.EnableKeyPoses failed.");
                }

                success = SetKeyPointsFilterLevel(MLHandTracking.KeyPointFilterLevel.ExtraSmoothed);
                if (!success)
                {
                    MLHandTracking.Stop();
                    _result = MLResult.Create(MLResult.Code.UnspecifiedFailure, "MLHandTrackingStarterKit failed to start correctly because MLHandTrackingStarterKit.SetKeyPointsFilterLevel failed because MLHandTracking.KeyPoseManager.SetKeyPointsFilterLevel failed.");
                }

                success = SetPoseFilterLevel(MLHandTracking.PoseFilterLevel.ExtraRobust);
                if (!success)
                {
                    MLHandTracking.Stop();
                    _result = MLResult.Create(MLResult.Code.UnspecifiedFailure, "MLHandTrackingStarterKit failed to start correctly because MLHandTrackingStarterKit.SetPoseFilterLevel failed because MLHandTracking.KeyPoseManager.SetPoseFilterLevel failed.");
                }
            }

            return(_result);
            #else
            return(new MLResult());
            #endif
        }
Ejemplo n.º 6
0
 private void OnDestroy()
 {
     MLHandTracking.Stop();
 }