//This function will de-activate all current datasets and activate the designated dataset. //It is assumed the dataset being activated has already been loaded (either through code //elsewhere or via the Vuforia Configuration). public void SwitchTargetByName(string activateThisDataset) { TrackerManager trackerManager = (TrackerManager)TrackerManager.Instance; ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); IEnumerable <DataSet> datasets = objectTracker.GetDataSets(); IEnumerable <DataSet> activeDataSets = objectTracker.GetActiveDataSets(); List <DataSet> activeDataSetsToBeRemoved = activeDataSets.ToList(); //Loop through all the active datasets and deactivate them. foreach (DataSet ads in activeDataSetsToBeRemoved) { objectTracker.DeactivateDataSet(ads); } //Swapping of the datasets should not be done while the ObjectTracker is working at the same time. //So, Stop the tracker first. objectTracker.Stop(); //Then, look up the new dataset and if one exists, activate it. foreach (DataSet ds in datasets) { if (ds.Path.Contains(activateThisDataset)) { objectTracker.ActivateDataSet(ds); } } //Finally, start the object tracker. objectTracker.Start(); }
void ActivateDataSets(bool enableDataset) { ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); // We must stop the ObjectTracker before activating/deactivating datasets if (objectTracker.IsActive) { objectTracker.Stop(); } if (!objectTracker.IsActive) { IEnumerable <DataSet> datasets = objectTracker.GetDataSets(); foreach (DataSet dataset in datasets) { // Activate or Deactivate each DataSet if (enableDataset) { objectTracker.ActivateDataSet(dataset); } else { objectTracker.DeactivateDataSet(dataset); } } } if (!objectTracker.IsActive) { objectTracker.Start(); } }
private void DeactivateGloveTargetTracking() { //get the object tracker instance ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (objectTracker == null) { return; } //get all available datasets and momentarily stop tracking List <DataSet> dataSets = objectTracker.GetActiveDataSets().ToList(); objectTracker.Stop(); //find the mainGloveTarget, and deactivate it foreach (DataSet dataSet in dataSets) { if (dataSet.Path.IndexOf(mainGloveTarget) != -1) { objectTracker.DeactivateDataSet(dataSet); } } objectTracker.Start(); }
// Este es solo para cargar el dataset pedido. Podría devolver falso si no carga. private bool loadTarget(string datasetName, string modelTargetName) { ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); DataSet dataSet = objectTracker.CreateDataSet(); if (!dataSet.Load(datasetName)) { return(false); } objectTracker.Stop(); // stop tracker so that we can add new dataset if (!objectTracker.ActivateDataSet(dataSet)) { // Note: ImageTracker cannot have more than 100 total targets activated Debug.Log("<color=yellow>Failed to Activate DataSet: " + datasetName + "</color>"); } else { Debug.Log("<color=blue>DataSet Activated : " + datasetName + "</color>"); } if (!objectTracker.Start()) { Debug.Log("<color=yellow>Tracker Failed to Start.</color>"); } return(true); }
void LoadDataSet() { ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker> (); DataSet dataSet = objectTracker.CreateDataSet(); if (dataSet.Load(MergeCube.MergeMultiTargetCore.DataSet, VuforiaUnity.StorageType.STORAGE_ABSOLUTE)) { objectTracker.Stop(); if (!objectTracker.ActivateDataSet(dataSet)) { Debug.LogError("Failed to Activate MergeCube DataSet"); } if (!objectTracker.Start()) { Debug.LogError("Tracker Failed to Start."); } int counter = 0; IEnumerable <TrackableBehaviour> tbs = TrackerManager.Instance.GetStateManager().GetTrackableBehaviours(); foreach (TrackableBehaviour tb in tbs) { if (tb.name == "New Game Object") { tb.gameObject.name = ++counter + ":DynamicImageTarget-" + tb.TrackableName; tb.gameObject.AddComponent <MergeTrackableEventHandler> (); } } } else { Debug.LogError("Failed to Load MergeCube Dataset"); } }
private void SetupTrackables() { // TODO: Avoid to load all trackables ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); DataSet dataSet = objectTracker.CreateDataSet(); if (dataSet.Load("SimpleARDefaultMarkers")) { objectTracker.Stop(); if (!objectTracker.ActivateDataSet(dataSet)) { // Note: ImageTracker cannot have more than 1000 total targets activated Debug.Log("<color=yellow>Failed to Activate DataSet: SimpleARDefaultMarkers</color>"); } if (!objectTracker.Start()) { Debug.Log("<color=yellow>Tracker Failed to Start.</color>"); } IEnumerable <TrackableBehaviour> tbs = TrackerManager.Instance.GetStateManager().GetTrackableBehaviours(); foreach (TrackableBehaviour tb in tbs) { predefinedNaturalMarkers.Add(tb.TrackableName, tb); } } }
void LoadDataSet() { VuforiaARController.Instance.UnregisterVuforiaStartedCallback(LoadDataSet); string dataSetName = "HoloC"; ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); DataSet dataSet = objectTracker.CreateDataSet(); EnableAllTrackedObjects(); if (dataSet.Load(dataSetName)) { objectTracker.Stop(); // stop tracker so that we can add new dataset if (!objectTracker.ActivateDataSet(dataSet)) { // Note: ImageTracker cannot have more than 100 total targets activated Debug.Log("<color=yellow>Failed to Activate DataSet: " + dataSetName + "</color>"); } if (!objectTracker.Start()) { Debug.Log("<color=yellow>Tracker Failed to Start.</color>"); } DisableAllTrackedObjects(); EnableCurrentTrackedObject(); } }
//This function will de-activate all current datasets and activate the designated dataset. //It is assumed the dataset being activated has already been loaded (either through code //elsewhere or via the Vuforia Configuration). public void DisableAllAndSet(NamedDataSet setAsActive) { ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); IEnumerable <DataSet> activeDataSets = objectTracker.GetActiveDataSets(); List <DataSet> activeDataSetsToBeRemoved = activeDataSets.ToList(); //Loop through all the active datasets and deactivate them. foreach (DataSet ads in activeDataSetsToBeRemoved) { objectTracker.DeactivateDataSet(ads); } if (setAsActive == null) { return; } //Swapping of the datasets should not be done while the ObjectTracker is working at the same time. //So, Stop the tracker first. objectTracker.Stop(); objectTracker.ActivateDataSet(setAsActive.set); //Finally, start the object tracker. objectTracker.Start(); }
public bool RestartCamera() { ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (objectTracker != null) { objectTracker.Stop(); } // Camera must be deinitialized before attempting to deinitialize trackers CameraDevice.Instance.Stop(); CameraDevice.Instance.Deinit(); if (!CameraDevice.Instance.Init()) { Debug.Log("Failed to initialize the camera."); return(false); } if (!CameraDevice.Instance.Start()) { Debug.Log("Failed to start the camera."); return(false); } if (objectTracker != null) { if (!objectTracker.Start()) { Debug.Log("Failed to restart the Object Tracker."); return(false); } } return(true); }
/// <summary> /// 关闭指定识别数据集 /// </summary> /// <param name="datasetName">数据集名称或绝对路径</param> public static void DeactivateDateset(string datasetName) { ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); IEnumerable <DataSet> activeDataSets = objectTracker.GetActiveDataSets(); List <DataSet> activeDataSetsToBeRemoved = activeDataSets.ToList(); List <DataSet> dataSetsToBeActive = new List <DataSet>(); foreach (DataSet ads in activeDataSetsToBeRemoved) { objectTracker.DeactivateDataSet(ads); if (!ads.Path.Contains(datasetName)) { dataSetsToBeActive.Add(ads); } else { objectTracker.DestroyDataSet(ads, false); var trackables = ads.GetTrackables(); foreach (var item in trackables) { TrackerManager.Instance.GetStateManager().DestroyTrackableBehavioursForTrackable(item, true); } } } objectTracker.Stop(); foreach (DataSet ds in dataSetsToBeActive) { objectTracker.ActivateDataSet(ds); } objectTracker.Start(); }
private bool RestartCamera(CameraDevice.CameraDirection direction) { ObjectTracker tracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (tracker != null) { tracker.Stop(); } CameraDevice.Instance.Stop(); CameraDevice.Instance.Deinit(); if (!CameraDevice.Instance.Init(direction)) { Debug.Log("Failed to init camera for direction: " + direction.ToString()); return(false); } if (!CameraDevice.Instance.Start()) { Debug.Log("Failed to start camera for direction: " + direction.ToString()); return(false); } if (tracker != null) { if (!tracker.Start()) { Debug.Log("Failed to restart the Tracker."); return(false); } } return(true); }
void OnVuforiaStarted() { ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); objectTracker.Stop(); IEnumerable <DataSet> dataSetList = objectTracker.GetActiveDataSets(); foreach (DataSet set in dataSetList) { if (set.Path != ("Vuforia/" + datasetName + ".xml")) { objectTracker.DeactivateDataSet(set); continue; } objectTracker.Start(); IEnumerable <TrackableBehaviour> trackableBehaviours = TrackerManager.Instance.GetStateManager().GetTrackableBehaviours(); foreach (TrackableBehaviour tb in trackableBehaviours) { if (set.Contains(tb.Trackable)) { GameObject go = tb.gameObject; go.AddComponent <DefaultTrackableEventHandler>(); //Insert code here : GameObject model = Instantiate(prefab) as GameObject; model.transform.parent = tb.transform; model.SetActive(true); tb.gameObject.SetActive(true); } } break; } }
public void ActivateDataSet(string datasetName) { // ObjectTracker tracks ImageTargets contained in a DataSet and provides methods for creating and (de)activating datasets. ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); IEnumerable <DataSet> datasets = objectTracker.GetDataSets(); IEnumerable <DataSet> activeDataSets = objectTracker.GetActiveDataSets(); List <DataSet> activeDataSetsToBeRemoved = activeDataSets.ToList(); // 1. Loop through all the active datasets and deactivate them. foreach (DataSet ads in activeDataSetsToBeRemoved) { objectTracker.DeactivateDataSet(ads); } // Swapping of the datasets should NOT be done while the ObjectTracker is running. // 2. So, Stop the tracker first. objectTracker.Stop(); // 3. Then, look up the new dataset and if one exists, activate it. foreach (DataSet ds in datasets) { if (ds.Path.Contains(datasetName)) { objectTracker.ActivateDataSet(ds); } } // 4. Finally, restart the object tracker. objectTracker.Start(); }
public void ChangeButton() { counter++; if (counter % 2 == 1 && togglebutton == false) { CameraDevice.Instance.Stop(); ObjectTracker imgTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); imgTracker.Stop(); togglebutton = true; mTrackerON = false; ButtonPlay.SetActive(true); ButtonPause.SetActive(false); } else { if (togglebutton == true) { CameraDevice.Instance.Start(); ObjectTracker imgTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); imgTracker.Start(); togglebutton = false; mTrackerON = true; ButtonPlay.SetActive(false); ButtonPause.SetActive(true); } } }
void LoadDataSet() { TrackerManager.Instance.InitTracker <ObjectTracker>(); ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); DataSet dataSet = objectTracker.CreateDataSet(); if (dataSet.Load(DataSetName)) { objectTracker.Stop(); // stop tracker so that we can add new dataset if (!objectTracker.ActivateDataSet(dataSet)) { // Note: ImageTracker cannot have more than 100 total targets activated Debug.Log("<color=yellow>Failed to Activate DataSet: " + DataSetName + "</color>"); } if (!objectTracker.Start()) { Debug.Log("<color=yellow>Tracker Failed to Start.</color>"); } int counter = 0; IEnumerable <TrackableBehaviour> tbs = TrackerManager.Instance.GetStateManager().GetTrackableBehaviours(); foreach (TrackableBehaviour tb in tbs) { if (tb.name == "New Game Object") { // change generic name to include trackable name tb.gameObject.name = ++counter + ":DynamicImageTarget-" + tb.TrackableName; // add additional script components for trackable tb.gameObject.AddComponent <DefaultTrackableEventHandler>(); tb.gameObject.AddComponent <TurnOffBehaviour>(); var augmentationObject = GameObject.CreatePrimitive(PrimitiveType.Cube); if (augmentationObject != null) { // instantiate augmentation object and parent to trackable GameObject augmentation = (GameObject)GameObject.Instantiate(augmentationObject); augmentation.transform.parent = tb.gameObject.transform; augmentation.transform.localPosition = new Vector3(0f, 0f, 0f); augmentation.transform.localRotation = Quaternion.identity; augmentation.transform.localScale = new Vector3(0.005f, 0.005f, 0.005f); augmentation.gameObject.SetActive(true); } else { Debug.Log("<color=yellow>Warning: No augmentation object specified for: " + tb.TrackableName + "</color>"); } } } } else { Debug.LogError("<color=yellow>Failed to load dataset: '" + DataSetName + "'</color>"); } }
private void LoadDataSet() { boss = PersistantManager.Instance; //Vuforia.ImageTarget; boss.hud.addText("LoadDataSet ()" + dataSetName); ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (objectTracker == null) { boss.hud.addText("error : TrackerManager.Instance.GetTracker<ObjectTracker>() == null"); return; } DataSet dataSet = objectTracker.CreateDataSet(); if (dataSetName == "") { boss.hud.addText("error : dataSetName not set"); return; } hasDataLoaded = false; dataset_With_Trackables = null; if (dataSet.Load(dataSetName)) { objectTracker.Stop(); // stop tracker so that we can add new dataset if (!objectTracker.ActivateDataSet(dataSet)) { // Note: ImageTracker cannot have more than 100 total targets activated //Debug.Log("<color=yellow>Failed to Activate DataSet: " + dataSetName + "</color>"); boss.hud.addText("Failed to Activate DataSet: " + dataSetName); } if (!objectTracker.Start()) { //Debug.Log("<color=yellow>Tracker Failed to Start.</color>"); boss.hud.addText("Tracker Failed to Start. " + dataSetName); } try { dataset_With_Trackables = TrackerManager.Instance.GetStateManager().GetTrackableBehaviours(); hasDataLoaded = true; } catch { boss.hud.addText(" collect trackables in " + dataSetName + ": Fail"); return; } } else { boss.hud.addText("Failed to load dataset: '" + dataSetName + "'"); } boss.workingIcon.Off(); }
public void OnDisableExtendeTracking() { ObjectTracker tracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); tracker.Stop(); ((ImageTarget)_trackableBehaviour.Trackable).StopExtendedTracking(); tracker.Start(); }
private void StartTracking() { if (_tracker != null && !_tracker.IsActive) { Debug.Log("************************************************************************Start tracking"); _tracker.Start(); } }
void Update() { if (Input.GetMouseButtonDown(0)) { //m_ObjectTracker.Stop (); if (m_ObjectTracker.IsActive) { m_ObjectTracker.Stop(); m_TargetBuildingBehaviour.StartScanning(); } else { BuildNewTarget(); m_ObjectTracker.Start(); debugMessage.SetDebugText("Tracking..."); } } }
public ARDataSet CreateVuforiaDataSet(ObjectTracker targetTracker) { targetTracker.Stop(); VuforiaDataSet = targetTracker.CreateDataSet(); VuforiaDataSet.Load(diskPath.xmlPath, VuforiaUnity.StorageType.STORAGE_ABSOLUTE); targetTracker.ActivateDataSet(VuforiaDataSet); targetTracker.Start(); return(this); }
public void LoadDataSet() { //code to change image target ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); string dataSetName = Args.VENTANA_DATA_SET_NAME; DataSet dataSet = objectTracker.CreateDataSet(); if (dataSet.Load(dataSetName, VuforiaUnity.StorageType.STORAGE_APPRESOURCE)) { objectTracker.Stop(); // stop tracker so that we can add new dataset if (!objectTracker.ActivateDataSet(dataSet)) { // Note: ImageTracker cannot have more than 1000 total targets activated Debug.Log("<color=yellow>Failed to Activate DataSet: " + dataSetName + "</color>"); } if (!objectTracker.Start()) { Debug.Log("<color=yellow>Tracker Failed to Start.</color>"); } int counter = 0; IEnumerable <TrackableBehaviour> tbs = TrackerManager.Instance.GetStateManager().GetTrackableBehaviours(); ModelController mc = ModelController.Instance; foreach (TrackableBehaviour tb in tbs) { if (tb.name == "New Game Object") { // change generic name to include trackable name tb.gameObject.name = ++counter + tb.TrackableName; // add additional script components for trackable tb.gameObject.AddComponent <DefaultTrackableEventHandler>(); tb.gameObject.AddComponent <TurnOffBehaviour>(); GameObject control = mc.GetPrefabWithId(Convert.ToInt32(tb.TrackableName, 16)); SpawnBehaviourScript spb = tb.gameObject.AddComponent <SpawnBehaviourScript>(); spb.prefabObject = control; if (control) { control.transform.SetParent(tb.gameObject.transform); control.transform.localPosition = new Vector3(0f, 0f, 0.9f); //control.transform.localRotation = Quaternion.identity * Quaternion.Euler(0, 180, 0); control.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f); } } } } else { Debug.LogError("<color=yellow>Failed to load dataset: '" + dataSetName + "'</color>"); } }
public void LoadDataset(string name) { ObjectTracker tracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); DataSet m_Dataset = tracker.CreateDataSet(); m_Dataset.Load(name, VuforiaUnity.StorageType.STORAGE_ABSOLUTE); tracker.Stop(); tracker.ActivateDataSet(m_Dataset); tracker.Start(); }
private void ReloadDataSet() { ObjectTracker objTracker = TrackerManager.Instance.GetTracker <ObjectTracker> (); DataSet dataset = objTracker.CreateDataSet(); dataset.Load("ozUnity_3LD"); objTracker.Stop(); objTracker.ActivateDataSet(dataset); objTracker.Start(); }
public void StartTracking() { Vuforia.enabled = true; ObjectTracker it = TrackerManager.Instance.GetTracker <ObjectTracker>(); MarkerTracker mt = TrackerManager.Instance.GetTracker <MarkerTracker>(); CameraDevice.Instance.Start(); it.Start(); mt.Start(); }
/// <summary> /// Takes a new trackable source and adds it to the dataset /// This gets called automatically as soon as you 'BuildNewTarget with UserDefinedTargetBuildingBehaviour /// </summary> public void OnNewTrackableSource(TrackableSource trackableSource) { mTargetCounter++; // deactivates the dataset first mObjectTracker.DeactivateDataSet(mBuiltDataSet); // Destroy the oldest target if the dataset is full if (mBuiltDataSet.HasReachedTrackableLimit()) { IEnumerable <Trackable> trackables = mBuiltDataSet.GetTrackables(); Trackable oldest = null; foreach (Trackable trackable in trackables) { if (oldest == null || trackable.ID < oldest.ID) { oldest = trackable; } } if (oldest != null) { Debug.Log("Destroying oldest trackable in UDT dataset: " + oldest.Name); mBuiltDataSet.Destroy(oldest, true); } } // get predefined trackable and instantiate it ImageTargetBehaviour imageTargetCopy = (ImageTargetBehaviour)Instantiate(ImageTargetTemplate); imageTargetCopy.gameObject.name = "UserDefinedTarget-" + mTargetCounter; textMesh = imageTargetCopy.gameObject.GetComponentInChildren <TextMesh>(); textMesh.text = "Target #" + mTargetCounter; // add the duplicated trackable to the data set and activate it mBuiltDataSet.CreateTrackable(trackableSource, imageTargetCopy.gameObject); // activate the dataset again mObjectTracker.ActivateDataSet(mBuiltDataSet); //Extended Tracking with user defined targets only works with the most recently defined target. //If tracking is enabled on previous target, it will not work on newly defined target. //Don't need to call this if you don't care about extended tracking. //StopExtendedTracking(); bool persist = mObjectTracker.PersistExtendedTracking(true); if (persist) { mObjectTracker.Stop(); mObjectTracker.ResetExtendedTracking(); mObjectTracker.Start(); } }
protected override void OnOpen(object userData) { base.OnOpen(userData); ObjectTracker tracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (tracker != null && !tracker.IsActive) { tracker.Start(); } BtnBack.onClick.AddListener(OnBackClick); }
protected override void OnTrackingStarted() { base.OnTrackingStarted(); if (manageVuforiaFrameRate) { Application.targetFrameRate = 30; } if (firstTime) { firstTime = false; StopTracking(); if (tracker != null) { tracker.Start(); } VuforiaBehaviour.Instance.enabled = true; } }
void LoadDataSet() { gameObjects = GetComponent <PrefabLoader>().ModelList; ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); DataSet dataSet = objectTracker.CreateDataSet(); if (dataSet.Load(dataSetName)) { objectTracker.Stop(); // stop tracker so that we can add new dataset if (!objectTracker.ActivateDataSet(dataSet)) { // Note: ImageTracker cannot have more than 100 total targets activated Debug.Log("<color=yellow>Failed to Activate DataSet: " + dataSetName + "</color>"); } if (!objectTracker.Start()) { Debug.Log("<color=yellow>Tracker Failed to Start.</color>"); } int counter = 0; IEnumerable <TrackableBehaviour> tbs = TrackerManager.Instance.GetStateManager().GetTrackableBehaviours(); foreach (TrackableBehaviour tb in tbs) { GameObject augmentationObject; gameObjects.TryGetValue(tb.TrackableName, out augmentationObject); tb.gameObject.name = ++counter + ":DynamicImageTarget-" + tb.TrackableName; // add additional script components for trackable tb.gameObject.AddComponent <DefaultTrackableEventHandler>(); tb.gameObject.AddComponent <TurnOffBehaviour>(); if (augmentationObject != null) { // instantiate augmentation object and parent to trackable GameObject augmentation = (GameObject)GameObject.Instantiate(augmentationObject); augmentation.transform.parent = tb.gameObject.transform; augmentation.transform.localPosition = new Vector3(0f, 0f, 0f); augmentation.transform.localRotation = Quaternion.identity; augmentation.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); augmentation.gameObject.SetActive(true); } else { Debug.Log("<color=yellow>Warning: No augmentation object specified for: " + tb.TrackableName + "</color>"); } } } }
/// <summary> /// Takes a new trackable source and adds it to the dataset /// This gets called automatically as soon as you 'BuildNewTarget with UserDefinedTargetBuildingBehaviour /// </summary> public void OnNewTrackableSource(TrackableSource trackableSource) { mTargetCounter++; // Deactivates the dataset first mObjectTracker.DeactivateDataSet(mBuiltDataSet); // Destroy the oldest target if the dataset is full or the dataset // already contains five user-defined targets. if (mBuiltDataSet.HasReachedTrackableLimit() || mBuiltDataSet.GetTrackables().Count() >= MAX_TARGETS) { IEnumerable <Trackable> trackables = mBuiltDataSet.GetTrackables(); Trackable oldest = null; Debug.Log(" text 123456789"); foreach (Trackable trackable in trackables) { if (oldest == null || trackable.ID < oldest.ID) { oldest = trackable; } } if (oldest != null) { Debug.Log("Destroying oldest trackable in UDT dataset: " + oldest.Name); mBuiltDataSet.Destroy(oldest, true); } } // Get predefined trackable and instantiate it ImageTargetBehaviour imageTargetCopy = (ImageTargetBehaviour)Instantiate(ImageTargetTemplate); imageTargetCopy.gameObject.name = "UserDefinedTarget-" + mTargetCounter; // Add the duplicated trackable to the data set and activate it mBuiltDataSet.CreateTrackable(trackableSource, imageTargetCopy.gameObject); // Activate the dataset again mObjectTracker.ActivateDataSet(mBuiltDataSet); // Extended Tracking with user defined targets only works with the most recently defined target. // If tracking is enabled on previous target, it will not work on newly defined target. // Don't need to call this if you don't care about extended tracking. StopExtendedTracking(); mObjectTracker.Stop(); mObjectTracker.ResetExtendedTracking(); mObjectTracker.Start(); // Make sure TargetBuildingBehaviour keeps scanning... mTargetBuildingBehaviour.StartScanning(); }
protected override void OnOpen(object userData) { base.OnOpen(userData); Debug.Log("UIScanForm Open"); //if(!EntryInstance.Scene.SceneIsLoaded(AssetUtility.GetSceneAsset("Scan"))) // EntryInstance.Scene.LoadScene(AssetUtility.GetSceneAsset("Scan")); ObjectTracker tracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (tracker != null && !tracker.IsActive) { tracker.Start(); } }