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); } } }
IEnumerator LoadUpdate() { while (!isLoaded) { yield return(new WaitForSeconds(.1f)); if (VuforiaRuntimeUtilities.IsVuforiaEnabled() && !isLoaded) { if (tracker == null) { tracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); } if (TotalDatas == null && tracker != null) { TotalDatas = tracker.CreateDataSet(); } if (File.Exists(dataPath) && TotalDatas.Load(dataPath, VuforiaUnity.StorageType.STORAGE_ABSOLUTE)) { isLoaded = true; tracker.ActivateDataSet(TotalDatas); ReadDataSet(); Debug.Log("Load DataSet Succeed!"); } else { Debug.Log("Load DataSet fail!"); } } } }
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(); } }
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"); } }
// 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); }
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(); }
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>"); } }
public void OnInitialized() // occurs when class is initialized, specifically our targetbuildingbehavior { objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); // initialize our objectTracker if (objectTracker != null) { // if objectTracker is found (!== null) dataSet = objectTracker.CreateDataSet(); // create dataset from our tracker objectTracker.ActivateDataSet(dataSet); // activate the dataset } }
public void OnInitialized() { m_objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (m_objectTracker != null) { m_BuildDataSet = m_objectTracker.CreateDataSet(); m_objectTracker.ActivateDataSet(m_BuildDataSet); //激活数据集 } }
public void OnInitialized() { objectTracker = TrackerManager.Instance.GetTracker<ObjectTracker>(); if (objectTracker != null) { dataSet = objectTracker.CreateDataSet(); objectTracker.ActivateDataSet(dataSet); } }
public void OnInitialized() { _objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (_objectTracker != null) { _udtDataSet = _objectTracker.CreateDataSet(); _objectTracker.ActivateDataSet(_udtDataSet); } }
public void OnInitialized() { m_ObjectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (m_ObjectTracker != null) { m_DataSet = m_ObjectTracker.CreateDataSet(); //如果m_ObjectTracker不为空的话,m_DataSet等于我新创建的数据集 m_ObjectTracker.ActivateDataSet(m_DataSet); //激活数据集 } }
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 OnInitialized() { _objectTracker = TrackerManager.Instance.GetTracker<ObjectTracker>(); if (_objectTracker != null) { _dataSet = _objectTracker.CreateDataSet(); _objectTracker.ActivateDataSet(_dataSet); } }
public void OnInitialized() // метод инициализации, подробнее по ссылке https://library.vuforia.com/articles/Training/User-Defined-Targets-Guide { ObjTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); // управление набором данных if (ObjTracker != null) //если дынный обьект есть { dataSet = ObjTracker.CreateDataSet(); // создаем новый набор данных для vuforia ObjTracker.ActivateDataSet(dataSet); // активация нового набора данных } }
public void OnInitialized() { objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (objectTracker != null) // if objectTracker is not null { dataSet = objectTracker.CreateDataSet(); // creating a new dataset objectTracker.ActivateDataSet(dataSet); } }
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>"); } }
/// <summary> /// Called when UserDefinedTargetBuildingBehaviour has been initialized successfully /// </summary> public void OnInitialized () { mObjectTracker = TrackerManager.Instance.GetTracker<ObjectTracker>(); if (mObjectTracker != null) { // create a new dataset mBuiltDataSet = mObjectTracker.CreateDataSet(); mObjectTracker.ActivateDataSet(mBuiltDataSet); } }
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(); }
/// <summary> /// Called when UserDefinedTargetBuildingBehaviour has been initialized successfully /// </summary> public void OnInitialized() { mObjectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (mObjectTracker != null) { // create a new dataset mBuiltDataSet = mObjectTracker.CreateDataSet(); mObjectTracker.ActivateDataSet(mBuiltDataSet); } }
/// <summary> /// Called when UserDefinedTargetBuildingBehaviour has been initialized successfully /// </summary> public void OnInitialized() { m_ObjectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (m_ObjectTracker != null) { // Create a new dataset m_UDT_DataSet = m_ObjectTracker.CreateDataSet(); m_ObjectTracker.ActivateDataSet(m_UDT_DataSet); } }
/// <summary> /// Called when UserDefinedTargetBuildingBehaviour has been initialized successfully /// </summary> public void OnInitialized() { m_ObjectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (m_ObjectTracker != null) { // Create a new dataset m_UDT_DataSet = m_ObjectTracker.CreateDataSet(); m_ObjectTracker.ActivateDataSet(m_UDT_DataSet); ImageTargetTemplate.gameObject.SetActive(true); } }
/// 在Vuforia初始化完成后call public void OnInitialized() { // Returns the instance of the given tracker type See the Tracker base class for a list of available tracker classes. This function will return null if the tracker of the given type has not been initialized. objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); //有新的instance就返回,没有就null if (objectTracker != null) { //set up新的DataSet dataSet = objectTracker.CreateDataSet(); //激活DataSet objectTracker.ActivateDataSet(dataSet); } }
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>"); } } } }
public void OnInitialized() { objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (objectTracker != null) { // this creates an empty data set for the temporary marker dataSet = objectTracker.CreateDataSet(); objectTracker.ActivateDataSet(dataSet); } // set it so that the AR camera can only see the video feed and nothing else of the scene GameObject.FindWithTag("MainCamera").transform.GetChild(0).gameObject.layer = 9; // ARBackground }
/// <summary> /// 默认的是从StreamingAssets/Vuforia加载程序集 /// </summary> /// <param name="dataSetName"></param> public static void LoadDataSet(string dataSetName) { ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); objectTracker.Stop(); DataSet dataSet = objectTracker.CreateDataSet(); if (dataSet.Load(dataSetName)) { //这里必须要停止跟踪才能激活DataSet objectTracker.ActivateDataSet(dataSet); } objectTracker.Start(); }
public void OnInitialized() { // look up the ImageTracker once and store a reference mObjectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (mObjectTracker != null) { // create a new dataset mBuiltDataSet = mObjectTracker.CreateDataSet(); mObjectTracker.ActivateDataSet(mBuiltDataSet); // remember that the component has been initialized mUdtInitialized = true; } }
public void OnInitialized() { // look up the ImageTracker once and store a reference mObjectTracker = TrackerManager.Instance.GetTracker<ObjectTracker>(); if (mObjectTracker != null) { // create a new dataset mBuiltDataSet = mObjectTracker.CreateDataSet(); mObjectTracker.ActivateDataSet(mBuiltDataSet); // remember that the component has been initialized mUdtInitialized = true; } }
private void SwitchDatabase(string[] dataSetsToBeActivated) { if (Input.GetKeyDown(KeyCode.D)) { IEnumerable <DataSet> activeDataSets = objectTracker.GetActiveDataSets(); List <DataSet> activeDataSetsToBeRemoved = new List <DataSet>(); activeDataSetsToBeRemoved.AddRange(activeDataSets); foreach (DataSet set in activeDataSetsToBeRemoved) { objectTracker.DeactivateDataSet(set); } objectTracker.Stop(); DataSet dataSet = objectTracker.CreateDataSet(); if (DataSet.Exists(dataSetNames[dataSetCounter])) { dataSet.Load(dataSetNames[dataSetCounter]); objectTracker.ActivateDataSet(dataSet); if (dataSetCounter == dataSetNames.Length - 1) { dataSetCounter = 0; } else { dataSetCounter++; } } IEnumerable <TrackableBehaviour> trackableBehaviours = TrackerManager.Instance.GetStateManager().GetTrackableBehaviours(); foreach (TrackableBehaviour tb in trackableBehaviours) { if (tb is ModelTargetBehaviour && tb.isActiveAndEnabled) { Debug.Log("TrackableName: " + tb.TrackableName); (tb as ModelTargetBehaviour).GuideViewMode = ModelTargetBehaviour.GuideViewDisplayMode.GuideView2D; mModelTarget = tb.GetComponent <ModelTargetBehaviour>(); } } objectTracker.Start(); } }
private void LoadeDatabase(string setName) { ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <objectTracker>(); objectTracker.Stop(); if (DataSet.Exists(setName)) { DataSet dataSet = objectTracker.CreateDataSet(); dataSet.Load(setName); objectTracker.ActivateDataSet(dataSet); } objectTracker.Start(); }
/// <summary> /// Loads a set of Vuforia markers from disk and activates it at runtime. /// </summary> /// <param name="dataSetName">Data set name.</param> public void LoadDataSet(string dataSetName) { if (tracker != null && !string.IsNullOrEmpty(dataSetName)) { var dataSets = tracker.GetActiveDataSets(); var targetPath = Path.Combine("Vuforia", dataSetName + ".xml"); var dataSet = dataSets.FirstOrDefault(ds => ds.Path == targetPath); if (dataSet == null) { dataSet = tracker.CreateDataSet(); dataSet.Load(dataSetName); tracker.ActivateDataSet(dataSet); } } }
private void LoadNewTargetModel(string dataBaseName) { TrackerManager tm = (TrackerManager)TrackerManager.Instance; objTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (objTracker == null) { return; } currentDataSet = objTracker.GetActiveDataSets().FirstOrDefault(); objTracker.Stop(); objTracker.DeactivateDataSet(currentDataSet); currentDataSet = objTracker.CreateDataSet(); currentDataSet.Load(dataBaseName); objTracker.ActivateDataSet(currentDataSet); objTracker.Start(); }