KeyframeController and RT_WRAP

I just played around with the KeyframeController a bit, and found that the RT_WRAP behavior is not quite what i would expect it to be. Look at this:


where kc is the KeyframeController, obviously. Shouldn't this result in a box, taking three seconds to transform into a sphere, and the next moment be a box again and start all over? It doesn't. Instead, it is a box, taking three seconds to become a sphere, and one more second to morph into a box again. if I add

kc.setNewAnimationTimes(0, 2);

it takes 2 seconds to become something 2/3 between a box and a sphere, and then, one more second to transform from an actual sphere to the box again.
Is there something I am missing? How can I make the KeyframeController behave the way I want it to?

I think this was a “feature” that has been recently added. It solves the md2’s jumping from the last frame to the first by morphing the last and first frames. But obviously, it shouldn’t be doing this if youve’ set it to WRAP. It should do this only on cycle…

The code for it is complicated for me personally, cep is the man for this.


Well, I fixed the issue for me with a quick hack in KeyframeController. But it would be nice to have an “official” solution, because 1. I haven’t fully understood all the code in KeyframeController, and 2. I am quite new to jme and 3d programming in general.

Plus I am currently working on a blender to jme exporter (see, and if somebody would want to try it out, they’ll surely expect RT_WRAP to behave just as I do.

Dark Prophet is right. That was put in there to make MD2 files animate correctly.

When I originally made KeyframeController and SpatialController they were made for specific file formats. I tried to make them generic so maybe other people could use them in the future. Making them both generic and animate the format correctly has been a challenge.

Reactivatig an anges old thread:

But, what about an additional RT_MD2 mode for KeyframeController? that way, KeyframeController can be generic, and behave correctly when loaded from xml, plus support md2s. Or, maybe there could be a separate MD2KeyframeController…

I don't think it is good practise to force a "hack" (no offence intended) needed for only one single model format upon the entire KeyframeController class.

If this is not really a md2-related problem, but about the "jumping to next animation" problem described here:

there should be something like KeyframeController.setAnimMorphTime(float millis), allowing 0.0 as a value for millis, to give users control over the behavior.

Or at least a boolean switch to turn that (admittedly sometimes useful) feature on or off.