/// <summary> /// Used for disabling the image tracker without resetting the API. /// </summary> public static MLResult Disable() { #if PLATFORM_LUMIN _result = MLImageTracker.Disable(); #endif return(_result); }
private void StopTracking() { if (MLImageTracker.IsStarted) { MLImageTracker.Disable(); anchorPlacer.SetActive(false); } }
/// <summary> /// Handles the event for trigger down. /// </summary> /// <param name="controllerId">The id of the controller.</param> /// <param name="triggerValue">The value of the trigger.</param> private void HandleOnTriggerDown(byte controllerId, float triggerValue) { if (_hasStarted && MLImageTracker.IsStarted && _controllerConnectionHandler.IsControllerValid(controllerId)) { if (MLImageTracker.GetTrackerStatus()) { MLImageTracker.Disable(); _trackerStatusLabel.text = "Tracker Status: Disabled"; } else { MLImageTracker.Enable(); _trackerStatusLabel.text = "Tracker Status: Enabled"; } } }
/// <summary> /// Used for disabling the image tracker without resetting the API. /// </summary> public static MLResult Disable() { #if PLATFORM_LUMIN if (MLImageTracker.IsStarted) { _result = MLImageTracker.Disable(); } else { _result = MLResult.Create(MLResult.Code.UnspecifiedFailure, "MLImageTracker was not started."); } #endif return(_result); }
/// <summary> /// Callback for when tracked image is found /// </summary> /// <param name="isReliable"> Contains if image found is reliable </param> private void OnTargetFound(bool isReliable) { if (!_calibrated && isReliable) { WorldOrigin.position = transform.position; WorldOrigin.rotation = transform.rotation; _calibrated = true; if (MLImageTracker.IsStarted) { MLImageTracker.Disable(); } Debug.Log("Image target found, calibration completed."); } }
/// <summary> /// Handles the event for trigger down. /// </summary> /// <param name="controllerId">The id of the controller.</param> /// <param name="triggerValue">The value of the trigger.</param> private void HandleOnTriggerDown(byte controllerId, float triggerValue) { if (_hasStarted && MLImageTracker.IsStarted && _controllerConnectionHandler.IsControllerValid(controllerId)) { // The ImageTracker status before it is changed bool trackerStatus = MLImageTracker.GetTrackerStatus(); // Try to change the ImageTracker status MLResult result = trackerStatus ? MLImageTracker.Disable() : MLImageTracker.Enable(); if (!result.IsOk) { Debug.LogErrorFormat("Error: Failed to {0} the ImageTracker.", trackerStatus ? "disable" : "enable"); } else { _trackerStatusLabel.text = "Tracker Status: " + (trackerStatus ? "Disabled" : "Enabled"); } } }
private void OnDestroy() { MLImageTracker.Stop(); MLImageTracker.Disable(); }