Как исправить Info Console Log JavaScript? - PullRequest
0 голосов
/ 30 апреля 2020

Я хочу спросить. Я пытаюсь создать дополненную реальность, используя Wikitude SDK (8.10 Android JavaScript SDK). Я получил ошибку: [INFO: CONSOLE (125)] "", источник: file: ///android_asset/cobarealobjek/js/aitor.js (125). Но я не знаю, как это исправить. У меня есть 3 часа, чтобы найти эту ошибку и не нашел ее.

var ServerInformation = {
    OBJECTDATA_SERVER: "https://api.npoint.io/fd10b6a203df24739c89",
};

var World = {
    loaded: false,
    drawables: [],
    objectData: [],
    firetruckRotation: {
        x: 0,
        y: 0,
        z: 0
    },
    firetruckCenter: {
        x: 0,
        y: -0.14,
        z: 0
    },
    firetruckLength: 0.5,
    firetruckHeight: 0.28,

    init: function initFn() {
        World.requestDataFromServer();
        World.createCones();
        World.createTracker();
    },


    loadObjectsFromJsonData: function loadObjectsFromJsonDataFn(data) {


        for (var currentObjectNr = 0; currentObjectNr < data.length; currentObjectNr++) {
            var singleObject = {
                "id": 1
                };

            console.log(singleObject['id'])
            World.objectData.push(singleObject);
        }
    },

    updateStatusMessage: function updateStatusMessageFn(message, isWarning) {
        var themeToUse = isWarning ? 'e' : 'c';
        var iconToUse = isWarning ? 'alert' : 'info';

        $('#status-message').html(message);
        $('#popupInfoButton').buttonMarkup({
            theme: themeToUse,
            icon: iconToUse
        });
    },

    requestDataFromServer: function requestDataFromServerFn() {

        /* Set helper var to avoid requesting places while loading. */
        World.isRequestingData = true;
        World.updateStatusMessage('Requesting places from web-service');

        /* Server-url to JSON content provider. */
        var serverUrl = ServerInformation.OBJECTDATA_SERVER

        var jqxhr = $.getJSON(serverUrl, function (data) {
                World.loadObjectsFromJsonData(data);
            })
            .error(function (err) {
                World.updateStatusMessage("Invalid web-service response.", true);
                World.isRequestingData = false;
            })
            .complete(function () {
                World.isRequestingData = false;
            });
    },

    createCones: function createConesFn() {
        var coneDistance = this.firetruckLength * 0.8;

        var frontLeftCone = World.getCone(-coneDistance, +coneDistance);
        World.drawables.push(frontLeftCone);

        var backLeftCone = World.getCone(+coneDistance, +coneDistance);
        World.drawables.push(backLeftCone);

        var backRightCone = World.getCone(+coneDistance, -coneDistance);
        World.drawables.push(backRightCone);

        var frontRightCone = World.getCone(-coneDistance, -coneDistance);
        World.drawables.push(frontRightCone);
    },

    getCone: function getConeFn(positionX, positionZ) {
        var coneScale = 0.05 * this.firetruckLength;

        return new AR.Model("assets/traffic_cone.wt3", {
            scale: {
                x: coneScale,
                y: coneScale,
                z: coneScale
            },
            translate: {
                x: positionX,
                y: World.firetruckCenter.y,
                z: positionZ
            },
            rotate: {
                x: -90
            },
            onError: World.onError
        });
    },

    createTracker: function createTrackerFn(id) {
        console.log(World.objectData)

            for (var i = 0; i < World.objectData.length; i++) {
                   this.targetCollectionResource = new AR.TargetCollectionResource("assets/test.wto", {
                onError: World.onError
            });
            this.tracker = new AR.ObjectTracker(this.targetCollectionResource, {
                onError: World.onError
            });
            this.objectTrackable = new AR.ObjectTrackable(this.tracker, World.objectData[i].id, {
                drawables: {
                    cam: World.drawables
                },
                onObjectRecognized: World.objectRecognized,
                onObjectLost: World.objectLost,
                onError: World.onError
            });
        }
    },

    objectRecognized: function objectRecognizedFn() {
        World.hideInfoBar();
        World.setAugmentationsEnabled(true);
    },

    objectLost: function objectLostFn() {
        World.setAugmentationsEnabled(false);
    },

    setAugmentationsEnabled: function setAugmentationsEnabledFn(enabled) {
        for (var i = 0; i < World.drawables.length; i++) {
            World.drawables[i].enabled = enabled;
        }
    },

    onError: function onErrorFn(error) {
        alert(error);
    },

    hideInfoBar: function hideInfoBarFn() {
        document.getElementById("infoBox").style.display = "none";
    },

    showInfoBar: function worldLoadedFn() {
        document.getElementById("infoBox").style.display = "table";
        document.getElementById("loadingMessage").style.display = "none";
    }
};

World.init();

Код ошибки относится к (125): https://pastebin.pl/view/fa21164a код ошибки image

...