Start a new topic
Solved

Multiple Targets in Array

Multiple Targets in Array


Ok I found out a way. And it's working, 

 

within a for loop I declared this way

loop(condition){

new AR.Trackable2DObject(this.tracker, "targetName", {

drawables: {

cam: new AR.ImageDrawable(new AR.ImageResource("assets/targetImage.png"), 1, {

offsetX: -0.15,

offsetY: 0

})

}

});

}

We are developing a backend to provide the targetcollection.wtc for each day. Prior to method call of World.init(), I am calling the targetcollection.wtc from my server, along with all the image urls and target names. But I am confused to create multiple overlays. Because in the example, we do

// Create overlay for page one

var imgOne = new AR.ImageResource("assets/imageOne.png");

var overlayOne = new AR.ImageDrawable(imgOne, 1, {

offsetX: -0.15,

offsetY: 0

});

var pageOne = new AR.Trackable2DObject(this.tracker, "pageOne", {

drawables: {

cam: overlayOne

}

});

 

and again we declare

 


// Create overlay for page two

var imgTwo = new AR.ImageResource("assets/imageTwo.png");

var overlayTwo = new AR.ImageDrawable(imgTwo, 0.5, {

offsetX: 0.12,

offsetY: -0.01

});

var pageTwo = new AR.Trackable2DObject(this.tracker, "pageTwo", {

drawables: {

cam: overlayTwo

}

});


 

Is it possible to create this overlays as an array?
Login or Signup to post a comment