/// <summary> /// Handles all the image target's this.status updates. This is called every frame. /// </summary> private void HandleAllTargetStatuses(MLImageTracker.Target target, MLImageTracker.Target.Result result) { if (result.Status != this.status) { this.status = result.Status; if (this.status == MLImageTracker.Target.TrackingStatus.Tracked || this.status == MLImageTracker.Target.TrackingStatus.Unreliable) { OnTargetFound(target, result); } else { OnTargetLost(target, result); } } else { OnTargetUpdated(target, result); } if (autoUpdate) { transform.position = result.Position; transform.rotation = result.Rotation; } }
private void HandleTrackerOnTargetLost(MLImageTracker.Target target, MLImageTracker.Target.Result result) { OnTargetLost?.Invoke(new MLMarkerTrackerArgs { Reference = _reference, Result = result, }); }
/// <summary> /// Handles all the image target's status updates. This is called every frame. /// </summary> private void HandleAllTargetStatuses(MLImageTracker.Target imageTarget, MLImageTracker.Target.Result newResult) { if (autoUpdate) { transform.position = newResult.Position; transform.rotation = newResult.Rotation; } }
/// <summary> /// Calls the appropriate StatusUpdate events for this target. /// </summary> public void HandleStatusUpdates(MLImageTracker.Target target, MLImageTracker.Target.Result result) { if (result.Status != Status) { Status = result.Status; if (Status == MLImageTracker.Target.TrackingStatus.Tracked || Status == MLImageTracker.Target.TrackingStatus.Unreliable) { OnFound?.Invoke(target, result); } else { OnLost?.Invoke(target, result); } } else { OnUpdated?.Invoke(target, result); } }
/// <summary> /// Callback for when image tracked is lost. /// </summary> private void OnTargetLost(MLImageTracker.Target target, MLImageTracker.Target.Result result) { gameObject.SetActive(false); }
/// <summary> /// Callback for when image tracked is updated. /// </summary> private void OnTargetUpdated(MLImageTracker.Target target, MLImageTracker.Target.Result result) { transform.position = result.Position; transform.rotation = result.Rotation; }
/// <summary> /// Callback for when image tracked is found. /// </summary> private void OnTargetFound(MLImageTracker.Target target, MLImageTracker.Target.Result result) { gameObject.SetActive(true); }