Hello,
Yesterday i decided to update my models in my game and after that the game started to behave really weird. After some debugging i found out that the onAnimCycleDone is not called anymore.
First i tought that there is something wrong with my new models but i made a more simple example wich was working a few weeks ago and now is not working anymore.
Yesterday i also made an update on the sdk.
Is these a bug or am i doing something wrong?
The simple example code, the animation is working fine the only problem is the onAnimCycleDone() method is never called:
[java]package mygame;
import com.jme3.animation.AnimChannel;
import com.jme3.animation.AnimControl;
import com.jme3.animation.AnimEventListener;
import com.jme3.app.SimpleApplication;
import com.jme3.math.ColorRGBA;
import com.jme3.scene.Node;
/**
test
@author normenhansen
*/
public class Main extends SimpleApplication implements AnimEventListener {
public static void main(String[] args) {
new Main().start();
}
AnimControl animControl;
AnimChannel animChannel;
@Override
public void simpleInitApp() {
Node model = (Node) assetManager.loadModel(“Models/gladiator/gladiator.j3o”);
animControl = model.getChild("gladiator").getControl(AnimControl.class);
animControl.addListener(this);
animChannel = animControl.createChannel();
animChannel.setAnim("walk");//24 frames animation
flyCam.setEnabled(true);
flyCam.setMoveSpeed(50);
viewPort.setBackgroundColor(ColorRGBA.Cyan);
rootNode.attachChild(model);
}
@Override
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
System.out.println("animation done: " + animName);
}
@Override
public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
System.out.println("animation changed: " + animName);
}
}
[/java]
1 Like
I have tested the code on another computer where i have an older version of jme and the code works fine.
nehon
March 31, 2014, 4:58am
3
could you upload your gladiator.j3o so I can test this?
I have uploaded the simple example wich does not work on my jme version:
Basic game url
Thank you for helping!
1 Like
Same here, since the 3.0.7 (if I’m not mistaken) update that I did today, the onAnimCycleDone method is not called anymore, both for Loop and DontLoop animations.
sgold
April 1, 2014, 3:39pm
6
Please provide a short test case.
I found some prior discussion of this issue: http://hub.jmonkeyengine.org/forum/topic/onanimcycledone-called-before-animation-completes/ Back in January, @nehon requested a test case, but it looks like he got no response. Change 10995 got backported into 3.0.7, so now the issue is more pressing.
@sgold said:
Please provide a short test case.
I found some prior discussion of this issue: http://hub.jmonkeyengine.org/forum/topic/onanimcycledone-called-before-animation-completes/ Back in January, @nehon requested a test case, but it looks like he got no response. Change 10995 got backported into 3.0.7, so now the issue is more pressing.
Isn’t my example good enough, or do you want more?
I would be happy to help.
sgold
April 1, 2014, 3:55pm
8
@Victor-Caliman said:
Isn't my example good enough, or do you want more?
I would be happy to help.
Sorry, I somehow overlooked your sample code. It looks adequate.
Spyd
April 1, 2014, 8:21pm
9
Take a look at this change in AnimChannel.
svn AnimChannel.java diff
I believe moving the time increment after the check for the notification and then fixing it with clampWrapTime(), causes the time to never be greater than the animation length so it never gets into the if block to call notifyAnimCycleDone().
As for a test case TestOgreAnim from the jme test cases does not work for me (onAnimCycleDone is never called).
nehon
April 2, 2014, 6:36pm
11
This time it should be fixed (original and current issue)
1 Like
normen
April 2, 2014, 6:38pm
12
@nehon said:
This time it should be fixed (original and current issue)
Should probably fix this in stable too… But we first have to move the build process for stable to git
2 Likes
Spyd
April 2, 2014, 7:01pm
13
@nehon said:
This time it should be fixed (original and current issue)
Thanks for the quick reply. I will test this when I get the chance.
1 Like
Yeah im getting this issue too. onAnimCycle was working fine before but then i updated jMonkey SDK and stopped working.
Hello all,
Same here
I’m waiting for the fix but wrote a small TEMP workaround because I had to release some playable version of Chaos
[java]
Timer tempTimer = new Timer();
// ------------------------------------------------------------------
// tempo workAround
// ------------------------------------------------------------------
tempTimer.schedule(new TimerTask() {
@Override
public void run() {
// simulate the event
onAnimCycleDone(animationControl, animationChannel, animName);
}
}, (long) (animationControl.getAnim(animName).getLength() * 1000f));
// ------------------------------------------------------------------
[/java]
Do the trick for me.
Cheers !
1 Like
sgold
April 21, 2014, 9:14pm
19
The issue should be fixed in 3.0.8, which is now available from the Update Center.
I have the latest update 3.0.10, but it seems like the method still isn’t called.