Image tracking with object drawing with Wikitude Plugin

40 Views Asked by At

I'm trying to draw an object when a image is recognized. I use the following code:

 var imgOneScale = 0.04;
 var imgOnePositionX = -0.52;
var imgOnePositionY = 0.24

this.imgOne = new AR.Model("https://www.docummedia.com/WikitudePlugin/01_ImageTracking_3_Interactivity/assets/ruption.wt3", {
    scale: {
        x: imgOneScale,
        y: imgOneScale,
        z: imgOneScale
    },
    translate: {
        x: imgOnePositionX,
        y: imgOnePositionY
    },
    rotate: {
        y: 180
    },
    enabled: false
});

World.drawables.push(this.imgOne);

this.pageOne = new AR.ImageTrackable(this.tracker, "CircleRuption_Black_MagentaFont_Large", {
     drawables: {
         cam: World.drawables
     },
     onImageRecognized: World.hideInfoBar,
         onError: World.onError
});

It is giving me the error: " Cannot read property 'push' of undefined"

Can someone help?

1

There are 1 best solutions below

0
Andi Luis On

It was missing the initialization of drawables:

drawables = [];