jmonkeyengine
jmonkeyengine copied to clipboard
AnimComposer: Add Features/Potential issues
To be examined and confirmed:
- tested animation "Standard Walk" from mixamo, the animation does not loop smoothly -> there is a jump at the point when the animation should repeat. (tried deleting the last frame, etc, it did not fix the issue) -to test the issue, I set the speed of layer to zero and on key press set speed to one, manually call update, set speed to zero, in order to jump from frame to frame. To my surprise, this produced fluid motion at the point where the animation repeats.
potential new features -loop modes (cannot run animation exactly once) / listeners -set animation time directly/set frame directly
PS: I tested if the problem was not in the animation file itself by moving the repeat point into middle (shifted the frames), and the problem was now not present at that point but at the new repeat point.
Regarding looping, I added support for looping in this PR: #1038 (not merged yet) Also alternative ways for supporting loop have discussed here: https://hub.jmonkeyengine.org/t/solved-when-animcomposer-reaches-the-end-of-an-action/41652
Yeah, I'm trying to convert our project to use the new animation system. The looping issue is a major thing for us. I understand the workaround and tried it. But as @Ali-RS pointed out, running the animation backwards doesn't work since all control is lost over the looping.
To be more specific, I tried to to re-create the ye olden loop modes in our code by creating a custom action. Cycle mode would then set the animation speed -1*speed when animation has reached the end. And it stops triggering after the speed is set to negative.
What was wrong with PR #1038 ? Wouldn't it have solved this?
What was wrong with PR #1038 ?
I think it had not been reviewed. I am not sure why I closed it though!
@TehLeo regarding
there is a jump at the point when the animation should repeat.
Maybe BlendableAction.setTransitionLength(0)
can help with this. See https://hub.jmonkeyengine.org/t/solved-animation-does-not-loop-properly/43272/8?u=ali_rs
What was wrong with PR #1038 ?
I think it had not been reviewed. I am not sure why I closed it though!
Yes, since I understood from the discussion that it is just waiting for the review :) Ideally looping, like in the old, Cycle, Loop, NoLooping would be built in. But if at least the bug is fixed with the backwards animation, I would be really happy. That could affect other stuff as well, and really, is a bug I think.
In my case, I use TweenAnimation for my tweens and play them with EffectControl
In TweenAnimation I can also control the looping, I can also extend it to support loop duration or loop count.
For backward playing, I create a new animation and wrap the tween I want to play backward, inside a reverse tween.
Edit: Unlike looping on TweenAnimation which does the looping for the whole animation, sometimes you might need looping on the tween level in which you are going to need a Loop tween. Say If you want a sequence of “walk for 5 seconds then run for 10 seconds” then you’d want to loop walk and run to get them up to the time necessary in the sequence.
How would you construct this reverse tween? I tried to make this action thingie to control the animation direction... https://github.com/tonihele/OpenKeeper/blob/18a04d03e361b2cbdea80c3b2a48edae5891952f/src/toniarts/openkeeper/view/animation/LoopAction.java
How would you construct this reverse tween?
Something like this:
public class Invert implements Tween {
private Tween delegate;
public Invert( Tween delegate ) {
this.delegate = delegate;
}
public double getLength() {
return delegate.getLenght();
}
public boolean interpolate( double t ) {
double lenght = getLenght();
if(t <= lenght) {
delegate.interpolate(lenght - t);
return true;
} else {
return false;
}
}
@Override
public String toString() {
return "Invert[delegate=" + delegate + "]";
}
}
Edit: Sorry, there was a typo in the constructor, fixed it.