Start a new topic

Looping ModelAnimation

Looping ModelAnimation


I'm trying to loop a 3D characters ModelAnimation, but despite setting .start(-1) on the animation it only plays through once then stops. Javascript is below, any suggestions what I'm doing wrong?

var World = {

loaded: false,


init: function initFn() {

this.createOverlays();

},


createOverlays: function createOverlaysFn() {

// Initialize Tracker

this.tracker = new AR.Tracker('assets/tracker.wtc', {

onLoaded: this.loadingStep

});


this.modelRvWalker = new AR.Model('assets/rv-walker.wt3', {

onLoaded: this.loadingStep,

scale: {

x: 0.15,

y: 0.15,

z: 0.15

},

translate: {

x: 0.0,

y: 0.05,

z: 0.0

},

rotate: {

roll: 0

}

});


// Idle Animation

this.idleAnimation = new AR.ModelAnimation(this.modelRvWalker, '3_animation');


var rvWalkerOptions = {

drawables: {

cam:

},

onEnterFieldOfVision: this.appear,

onExitFieldOfVision: this.hide

};


var trackableRvWalkerBack = new AR.Trackable2DObject(this.tracker, 'rv-walker-back-test', rvWalkerOptions);

var trackableRvWalkerFront = new AR.Trackable2DObject(this.tracker, 'rv-walker-front-test', rvWalkerOptions);

var trackableQrCode = new AR.Trackable2DObject(this.tracker, 'qrcode', rvWalkerOptions);

var trackableILoveAr = new AR.Trackable2DObject(this.tracker, 'ILoveAR', rvWalkerOptions);



},


loadingStep: function loadingStepFn() {

if (!World.loaded && World.tracker.isLoaded() && World.modelRvWalker.isLoaded()) {

World.loaded = true;

document.body.removeChild(document.getElementById('loadingMessage'));

}

},


appear: function appearFn() {

World.idleAnimation.start(-1);

},


hide: function hideFn() {

World.idleAnimation.stop();

}


};


World.init();

 

Hi,

Unfortunately we can't reproduce this behaviour with your code. Could you zip all files of your project including the assets, the tracker and the target image and send it to forum{at}wikitude.com?

Thx

Nicola

+1

Hi, 

We have the same issue on android devices. The animation loop perfectly on iOS but on Android devices the animation runs 1 time and then stops.

Thx

After more testing we found out that it's not on all android devices. The problem only appears on a GS3 running Jelly bean.

 

 

Thank's to everyone for the valuable feedback. We found a bug when initializing a ModelAnimation which will be fixed with the next update.

The following workaround should work. Instantiate the ModelAnimation every time before you start the animation:

var idleAnimation = new AR.ModelAnimation(this.modelRvWalker, '3_animation');
idleAnimation.start(-1);


Another issue that occurs is when you have more instances of one model and you want to loop all instances infinite times.
The workaround for this is to create as many Model objects as you need and animate every single modle instance.

With the next updates you won't need those workarounds anymore and the bug will be fixed. Please let me know if the workarounds work for you. We apologize for inconveniences caused.

Regards,
Christian
Login or Signup to post a comment