[SOLVED] Animation does not loop properly

Greetings all,
I tried to find a similar thread to my problem but could not find anything close to what I am experiencing. That, or I do not know what to google. I made a model in blender with animations. The model’s name is Lisa, lisa is now famous because she is on the internet. The animation plays well in loop in blender. I will attach an animated gif here:


I brought lisa into JME and converted .blend into .j3o. In the scene view the animation plays well. I will attach an animated gif here:


When I play the game the animation starts correctly, but then stutters inbetween loops. It is a walk animation. the start frame is identical to the end frame. I will attach an animated gif here:


As you can see the animation stutters, if that’s the best word. in the simple update loop I have:
(edit) ok that does not really show the studder well. I will attach another animated gif here.


This one seems to show that at the end of the walk cycle lisa returns to idle…

animationChannel.setAnim("walking-baked", 0.2f); 
animationChannel.setLoopMode( LoopMode.Loop );

I copied the code in the program from " Walking Character" tutorial. I can attach the whole java file if someone would like it. I can also attach the j3o and the blend file if those would be helpful. I have tried setAnim with no blend time, same reaction. I have tried 0 blend time, plays animation once then stops in t-pose. Well ok, its more of a sloppy t-pose. I have tried .1f to 10f in increments, but not every increment. I do not under stand why this jitter would be happening. Any insights would be fantastic. Thank you in advance.

Well, after I edited the thread to show the stutter better I noticed that it was playing the idle animation at the end of the walk cycle. I checked onAnimCycleDone and it had “channel.setAnim(“idle-baked”);” I commented that out and now it works great.


Also make sure that your animation has enough keyframes (>50). When it’s lower than this, JME has some issues calculating the correct interpolation that can cause weird looping behaviour.

oh thank you for that tip, I was not aware of that.

24 key frames per sec of animation. The same as film. Seems to work pretty good.

Edit: What is it about 50 that makes the difference? Just curious since this is the first I heard of this.

The 50 is not a magic number, it’s just a number I picked. Probably > ~30 will also be ok.
I know there is something about jme not properly interpolating between the first and last key frame of an animation. Or at least it used to be.

If your animation has a very low number of keyframes you can get pauses between the loop.

This is with gltf and setting the interpolate key frames option? Or some other unrecommended way?

Note, this pause can happen if the first and last frames are the same (common on looping animations i.e walk, run,…) it’s because of default transitionLength

In JME 3.3 you can fix it by setting it to 0 for looping animations.


Thanks for the clarification, I will add this to wiki.