Start a new topic

DistanceLabel updation in Marker.js

DistanceLabel updation in Marker.js

I am a newbie in wikitude, But I have almost completed my first app. I have one query. I have shown  the distance of the POI from the user, in the HTML panel that slides in from the right. However, What I want is to have the distance to the POI shown in the marker on the camera screen itself. I know that this is possible. But I am facing some difficult. This is from where i create the markers.

for (var currentPlaceNr = 0; currentPlaceNr < poiData.length; currentPlaceNr++) {
var singlePoi = {
"id": poiData.id,
"latitude": parseFloat(poiData.latitude),
"longitude": parseFloat(poiData.longitude),
"altitude": parseFloat(poiData.altitude),
"title": poiData.name,
"description": poiData.description
};

World.markerList.push(new Marker(singlePoi));
}

The following is the creation of the marker, in the marker.js file.

 this.markerObject = new AR.GeoObject(markerLocation, {
        drawables: {
            cam: ,
            indicator: this.directionIndicatorDrawable
        }
    });

However, I need to have the distanceLabel property here. From where can I access it?

I update the distance to user values like this.

updateDistanceToUserValues: function updateDistanceToUserValuesFn() {
for (var i = 0; i < World.markerList.length; i++) {
World.markerList.distanceToUser = World.markerList.markerObject.locations.distanceToUser();
}
},

But I cannot get the distance property to the marker.js file at the time the marker is created. Any way to do that?

Thanks in advance,

Did you get any solution for this?

Hello Hardik,

Are you also trying to display the distance on the marker? Then please, review the following forum posts:

Thanks
Eva

 

Login or Signup to post a comment