Start a new topic
Solved

Drawable On Marker Selected

Simply what i want to do is show an image after a marker is selected 

what i did is 


first defined image and its overlay on World


  

 var imgOne = new AR.ImageResource("assets/imageOne.png");
var overlayOne = new AR.ImageDrawable(imgOne, 1, {
			translate: {
				x: -0.15
			}
		});

   then onMarkerSelected(marker)  I created Geo Object 

 

new AR.GeoObject(marker.markerObject.locations, {
        drawables: {
            cam: World.overlayOne
        }
    });

 

when i run this nothing shows up on marker selected 





1 person has this problem

Thanks, Alex and Eva 


it worked perfectly 


and many thanks for the fast response 

Hi Bayan,


since you already have a GeoObject for the marker you want to select I would suggest that you add the drawable you want to display when the marker is selected to that GeoObject with GeoObject.drawables.addCamDrawable.


Best Regards,

Alex

i have gone through the document before so many times. i tried other multiple solutions: 


  • Tried relative location with different parameters 
  • Checked image scale and increased it (i used the image on surfer example to be sure of the scale and also increased it to 10) 
  • Adding the GeoObject in onClick function of the Marker 
  • I also  passed markerLocation from Marker class to world so onMarkerSelected would look like 


  

Js
	onMarkerSelected: function onMarkerSelectedFn(marker) {
		World.currentMarker = marker;
          var m = new AR.GeoObject(marker.markerLocation, {
                    drawables: {
                        cam: World.overlayOne
                    }
                });
		}

   and in all of the above, the result is that the marker animation runs as expected but there is no drawable shown anywhere insight  

Hello Bayan,

Please go through our documentation to see all relevant information regarding how to work with GeoLocation method.

Thanks
Eva

 

Login or Signup to post a comment