Hi,
I'm looking for a little bit of advice on the best way to accomplish what I would assume to be a fairly common task. Unfortunately I can't for the life of me find the answer.
I have a Unity QCAR Project that needs to track 10 different trackers. The trackers have been uploaded to the Tracking Web app and downloaded as a custom unity package, and imported into the project. The Experience is exactly the same regardless of which tracker is tracked -- a 3D model is displayed and animated. The part I can't figure out is the best way to set up the project.
I've tried adding 10 different Imagetargets and attaching the model to each of them but there is a HUGE performance hit when you do this. Ideally I'd like to be able to set which tracker QCAR should be looking for when I load the scene, as it only needs to look for one tracker at a given time, and I'll know which tracker it should be looking for when the scene loads, I thought I could do this programatically, however after a look at TrackableBehaviour.cs this appears to be not allowed. Acknowledging this is not allowed what is the best way to accomplish the task at hand without creating 10 different scenes?
Please point me in the right direction.
Thanks
Joe
#######TrackableBehaviour.cs#########
// The name of the trackable.
public string TrackableName
{
get { return mTrackableName; }
set
{
if (!Application.isEditor)
{
Debug.LogError("TrackableBehaviour: The name of a trackable " +
"must not be set at run-time.");
return;
}
mTrackableName = value;
}
}
Thanks Kim, works like a charm! :)
What worked for me was duplicating the original TrackableEventHandler script that is attached with the ImageMarker prefab and pasted just these lines from Kim`s code:
Then I switched the original TrackableEventHandler to my custom one, it has the same base functionalities and also sets my model position to the current trackable one.