I can't seem to get this code to work. Has anybody had any luck with it?
https://developer.vuforia.com/forum/faq/unity-load-dataset-setup-trackables-runtime
I can't seem to get this code to work. Has anybody had any luck with it?
https://developer.vuforia.com/forum/faq/unity-load-dataset-setup-trackables-runtime
I have tried implementing loading 3D Models & trackers dynamically..it's working perfectly. When I click 3D model scene, very first time it is work perfectly. I close the scene and again clicked on 3D scene from multiple scene menu options...then focused on Chips image. I am not seeing augmenting tracking object anymore. Event is not triggering(Tracker Found/Tracker Lost)
Can anyone please let me know what will be the issues?
I'm stuck on this too. the target tracks on the camera but it's not triggering anything in defaulttrackablebehaviour
I have tried implementing loading 3D Models & trackers dynamically..it's working perfectly. When I click 3D model scene, very first time it is work perfectly. I close the scene and again clicked on 3D scene from multiple scene menu options...then focused on Chips image. I am not seeing augmenting tracking object anymore. Event is not triggering(Tracker Found/Tracker Lost)
Can anyone please let me know what will be the issues?
Anyone have managed to get this to use with videos? Somehow I managed to get a cube from the scene to show up... not sure how haha. At one point I got the video X to show up, but that was just for a short second. I had hoped that I could get videos up and loaded when needed to prevent the app from overloading memory on phones.
*Edit*
Actually... I have 3 trackables with 3 videos. I have Imagetarget 1,2 and 3 in my scene all set up with video prefab. Then I have the Imagetargets set up to 3 empty game objects with the script on and the database name in line. For some strange reason Imagetarget 2 shows up with the X (video there). Meanwhile on Imagetarget 1 and 3 I get a white X-axis and Y-Axis line into the centre of the trackables but noting more. It is almost as if it find them but can't display videos. Any ideas? also how would I expand the script to be able to find 3+ databases?
Ok so the renderer problem. isn't a problem. my laptop hasn't been able to use the scene in play mode in forever and i wasn't aware thats what it does until tracked.
now when the image target is tracked the mesh renderer is activated, but the model doesn't show up on the image target (so I guess it isn't taking the trackers position and applying it to the model) and under the arcamera it is still never checked.
I will continue to update this once it is working properly to help out everyone else but if anyone has any idea, I am all ears
this is the exact code I am using if anyone wants to point out for me what I am doing wrong. Thank You
using UnityEngine;
using System.Collections;
using Vuforia;
using System.Collections.Generic;
using UnityEngine.UI;
public class DynamicDataSetLoader : MonoBehaviour
{
// specify these in Unity Inspector
public GameObject augmentationObject = null; // you can use teapot or other object
public string DATASETNAME = ""; // Assets/StreamingAssets/QCAR/DataSetName
public string text = "";
public Text test = null;// Use this for initialization
void Start()
{VuforiaBehaviour vb = GameObject.FindObjectOfType<VuforiaBehaviour>();
vb.RegisterVuforiaStartedCallback(LoadDataSet);
}void LoadDataSet()
{
string dataSetName = Application.streamingAssetsPath + "/QCAR/" + DATASETNAME + ".xml";
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>");
text = "<color=yellow>Failed to Activate DataSet: " + dataSetName + "</color>";
}if (!objectTracker.Start())
{
Debug.Log("<color=yellow>Tracker Failed to Start.</color>");
text = "<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>();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>");
text ="< color = yellow > Warning: No augmentation object specified for: " + tb.TrackableName + " </ color > ";
}
}
}
}
else
{
Debug.LogError("<color=yellow>Failed to load dataset: '" + dataSetName + "'</color>");
text = "<color=yellow>Failed to load dataset: '" + dataSetName + "'</color>";
}
}
public void Update()
{
if (text != "")
{
test.text = text;
}
}}
So I found the solution to make this code work. You need to change:
void Start()
{
QCARBehaviour qcb = GameObject.FindObjectOfType<QCARBehaviour>();
qcb.RegisterQCARStartedCallback(LoadDataSet);
}
To:
VuforiaBehaviour qcb = GameObject.FindObjectOfType<VuforiaBehaviour> ();
qcb.RegisterVuforiaStartedCallback(LoadDataSet);
and if you are loading from the Steaming/QCAR folder you need to set the path as just putting the string name of the .xml file does not access the dataset.
Like this - public string dataSetName = Application.streamingAssetsPath + "/QCAR/" + DATASETNAME + ".xml";
We have the same issue.
Tracking works fine, but the targets are not triggering anything in defaulttrackablebehaviour.
Is anyone able to help?