Hola, I wonder if there is a reliable way avaiable to check if an animation with LoopMode "Dontloop" is finished.
Actually since jME2 I wonder why clamp or dontloop don't stop the controller as it finished its job!?
If you want to blend from the finished channel-animation, the AnimController would have to be enabled again and the new Animation would be blended from the finished animation. Ok, if using different animation-channels for diffent parts of the skeleton (once it is available) you would have to check if all channels of the animation-controller are finished before disabling the controller.
Or maybe there is a logic behind that behaviour I don't see?!?
One first step could be to mark the Channel as finished when you reached the end of the animation, so you could react on that (e.g. start the next animation…). But we really should discuss the disabling of the whole controller if not needed.
Index: src/core/com/jme3/animation/AnimChannel.java
===================================================================
--- src/core/com/jme3/animation/AnimChannel.java (revision 5004)
+++ src/core/com/jme3/animation/AnimChannel.java (working copy)
@@ -20,8 +20,10 @@
private float blendAmount = 1f;
private float blendRate = 0;
+
+ private boolean finished = false;
- private static float clampWrapTime(float t, float max, LoopMode loopMode){
+ private float clampWrapTime(float t, float max, LoopMode loopMode){
if (t < 0f){
switch (loopMode){
case DontLoop:
@@ -34,6 +36,7 @@
}else if (t > max){
switch (loopMode){
case DontLoop:
+ finished = true;
return max;
case Cycle:
return max;
@@ -102,6 +105,7 @@
time = 0;
speed = 1f;
loopMode = LoopMode.Loop;
+ finished = false;
}
public void setAnim(String name){
@@ -135,4 +139,13 @@
}
}
+ /*
+ * finished a DontLoop-Animation?
+ */
+ public boolean isFinished() {
+ return finished;
+ }
+
+
+
}