Start a new topic

onClick trigger not working for animated 3D model.

I have an animated 3D model at a geoLocation. Where do I declare the onClick? (Wikitude documentation is confusing a bit because both of them seems to have their own "Onclick")

1. In the Model

2. In the GeoObject?

Since  I am confused about which would the better optimized and efficient way. But either way, my click event is not working. It is printing the alert when I debug in browser, but NOT on phone.

The following is my model animation and click event.


var location = new AR.RelativeLocation(null, 90, 90, 40);
var indicatorImage = new AR.ImageResource("assets/indi.png");

   var indicatorDrawable = new AR.ImageDrawable(indicatorImage, 0.1, {
            verticalAnchor: AR.CONST.VERTICAL_ANCHOR.TOP

	var modelCoin = new AR.Model("assets/coinqwerty.wt3", {
			onLoaded:function() { 
			  var obj = new AR.GeoObject(location, {
                   drawables: {
                     cam: [modelCoin],
                      indicator: [indicatorDrawable]
			 onEnterFieldOfVision: function() {
		            	//dragonVisible = true;
		            	//ajax here
		      onExitFieldOfVision: function() {
		            	//dragonVisible = false;
			onError: function(err) {
			scale: {
				x: 5,
				y: 5,
				z: 5
			translate: {
				x: 0,
				y: 0,
				z: 0
			rotate: {
				//heading: 180,
				//tilt: -40
			onClick: function() {
//console.log('clicked the dragon');
						alert("coin clicked");

 modelCoin.onInitialized =function()

	 var coinAnimation= new AR.ModelAnimation(modelCoin,ANIMATION_TO_LOOP);
			setTimeout(function() {coinAnimation.start(-1); }, 500);	



1 Comment

Hello Ashif,

Please read carefully the following examples as they explain in details what you want to accomplish with your use case:

 Also refer to this section to understand how to define the onClick event and to this sample to see how to implement it.



Login or Signup to post a comment