2015-08-01 3 views
0

Я пробовал в течение нескольких дней и не могу получить пример приложения приложения Wikitude. Я новичок в этой инфраструктуре. Документация bu не дает мне ясного объяснения. Я пытаюсь это: * Внутри моя голова тега я включил Wikitude плагин (и, конечно, я поставил ми пробного лицензионного ключа), например:Не удается получить пример приложения wikitude

<script src="js/WikitudePlugin.js"></script> 
  • Далее я написал пример кода:

    var World = { 
         loaded: false, 
    
         init: function initFn() { 
          this.createOverlays(); 
         }, 
    
        createOverlays: function createOverlaysFn() { 
        this.tracker = new AR.ClientTracker("assets/magazine.wtc", { 
         onLoaded: this.worldLoaded 
        }); 
    
    
        this.imgButton = new AR.ImageResource("assets/wwwButton.jpg"); 
    
        /* 
         The next step is to create the augmentation. In this example an image resource is created and passed to the AR.ImageDrawable. A drawable is a visual component that can be connected to an IR target (AR.Trackable2DObject) or a geolocated object (AR.GeoObject). The AR.ImageDrawable is initialized by the image and its size. Optional parameters allow for position it relative to the recognized target. 
        */ 
        var imgOne = new AR.ImageResource("assets/imageOne.png"); 
        var overlayOne = new AR.ImageDrawable(imgOne, 1, { 
         offsetX: -0.15, 
         offsetY: 0 
        }); 
    
        /* 
         For each target an AR.ImageDrawable for the button is created by utilizing the helper function createWwwButton(url, options). The returned drawable is then added to the drawables.cam array on creation of the AR.Trackable2DObject. 
        */ 
        var pageOneButton = this.createWwwButton("http://n1sco.com/specifications/", 0.1, { 
         offsetX: -0.25, 
         offsetY: -0.25, 
         zOrder: 1 
        }); 
    
        /* 
         This combines everything by creating an AR.Trackable2DObject with the previously created tracker, the name of the image target as defined in the target collection and the drawable that should augment the recognized image. 
         Note that this time a specific target name is used to create a specific augmentation for that exact target. 
        */ 
        var pageOne = new AR.Trackable2DObject(this.tracker, "pageOne", { 
         drawables: { 
          cam: [overlayOne, pageOneButton] 
         } 
        }); 
    
        /* 
         Similar to the first part, the image resource and the AR.ImageDrawable for the second overlay are created. 
        */ 
        var imgTwo = new AR.ImageResource("assets/imageTwo.png"); 
        var overlayTwo = new AR.ImageDrawable(imgTwo, 0.5, { 
         offsetX: 0.12, 
         offsetY: -0.01 
        }); 
        var pageTwoButton = this.createWwwButton("http://goo.gl/qxck1", 0.15, { 
         offsetX: 0, 
         offsetY: -0.25, 
         zOrder: 1 
        }); 
    
        /* 
         The AR.Trackable2DObject for the second page uses the same tracker but with a different target name and the second overlay. 
        */ 
        var pageTwo = new AR.Trackable2DObject(this.tracker, "pageTwo", { 
         drawables: { 
          cam: [overlayTwo, pageTwoButton] 
         } 
        }); 
    }, 
    
    createWwwButton: function createWwwButtonFn(url, size, options) { 
        /* 
         As the button should be clickable the onClick trigger is defined in the options passed to the AR.ImageDrawable. In general each drawable can be made clickable by defining its onClick trigger. The function assigned to the click trigger calls AR.context.openInBrowser with the specified URL, which opens the URL in the browser. 
        */ 
        options.onClick = function() { 
         AR.context.openInBrowser(url); 
        }; 
        return new AR.ImageDrawable(this.imgButton, size, options); 
    }, 
    
    worldLoaded: function worldLoadedFn() { 
        var cssDivInstructions = " style='display: table-cell;vertical-align: middle; text-align: right; width: 50%; padding-right: 15px;'"; 
        var cssDivSurfer = " style='display: table-cell;vertical-align: middle; text-align: left; padding-right: 15px; width: 38px'"; 
        var cssDivBiker = " style='display: table-cell;vertical-align: middle; text-align: left; padding-right: 15px;'"; 
        document.getElementById('loadingMessage').innerHTML = 
         "<div" + cssDivInstructions + ">Scan Target &#35;1 (surfer) or &#35;2 (biker):</div>" + 
         "<div" + cssDivSurfer + "><img src='assets/surfer.png'></img></div>" + 
         "<div" + cssDivBiker + "><img src='assets/bike.png'></img></div>"; 
    
        // Remove Scan target message after 10 sec. 
        setTimeout(function() { 
         var e = document.getElementById('loadingMessage'); 
         e.parentElement.removeChild(e); 
        }, 10000); 
        } 
    }; 
    
    World.init(); 
    

Я не знаю, что я делаю неправильно, если я пишу некоторое предупреждение в инициализации functionit ничего не показывает.

ответ

0

Так как ваш вопрос требует некоторых вопросов взад и вперед и не подходит для формата вопросов/ответов StackOverflow. Я предлагаю переместить это обсуждение в вашу тему на наших форумах: http://www.wikitude.com/developer/developer-forum/-/message_boards/message/690051?p_p_auth=Br6dzsxQ

+0

Я сделал это, и они мне не помогают! – user3417460

Смежные вопросы