Start a new topic

Get Target name dyanamically

Get Target name dyanamically


suppose, i upload 100 images on target manager and export .wtc file from target manager.

and place this file in asset folder 

so my question is how can i place "target name" dyanamically in AR.Trackable2DObject.

var pageOne = new AR.Trackable2DObject(this.tracker, "here i want target name dyanamically from .wtc file when i scan specific file through camera ", {

drawables: {

cam: overlayOne

}

});

 

please give me solution on it..

sorry for bad english..

 

Hi Prashant,
It's currently not possible to exchange the target name of a Trackable2DObject. The Trackable2DObject has to know to which target it belongs when it's created.
A possible solution for your problem could be, that you create a array with all your target names in JS and then create 100 Trackable2DObjects in a loop, setting the target name using the value in the array.

Best regards
Andreas

Hi,

Little up on this post :

Is it possible, once the image has been recognized, to get the target name ? Here's my code : 

var pageOne = new AR.Trackable2DObject(this.tracker, "*", {
onEnterFieldOfVision: function () {
if (loaded = true) {
console.log("Target name : " + this.targetName);
var redirection = new AR.context.openInBrowser("https://www.myurl.com/THE_TARGET_NAME");
}
}
});

 

Thanks.

As written in the documentation, the first parameter of the onEnterFieldOfVision is the targetName in case you were using wildcard.

BR,
Andreas
Login or Signup to post a comment