Use 1 animation clip for opposing directions and using getTime\setTime

I created a bunch of animation clips that are intended for movement in two directions each Fwd/Bwd Left/Right but jme3 doesn’t support negative speeds, is there another way the get clips to cycle +/- and can getTime be used to smoothly swap and sync between clips at a given “frame”/time in a clip?

e.g. let say I have “run shoot fwd clip” and wanted to quickly change that to “run shoot dwn clip” (same length) but we want to do the swap such that if “run shoot fwd clip” was 80% done that “run shoot dwn clip” would smoothly start at 81% end and thereafter fully loop until another change is triggered

In my game the player controls bullet direction but the weapon direction may not always align immediately or fully with the bullets, since I chose to pose aiming in my hero character “stylized”

Note: I have animations for all four basic directions for some chosen weapon angles, it just seems like wasting effort since they were duplicated and mirrored on the timeline with no added posing in blender.

I have tried to “spit” getTime to the console to better understand it but I only get 0 or 1

You can use the reverseAnimation() method from the Wes library to create a reverse-time version of each clip:

        AnimComposer composer = sinbadModelRoot.getControl(AnimComposer.class);
        AnimClip forward = composer.getAnimClip("StandUpBack");
        String reverseName = "LieDown";
        AnimClip reverse = AnimationEdit.reverseAnimation(forward, reverseName);

Or you can write your own custom animation control.

Or you can submit a pull request to add support for negative speeds in AnimComposer.

I think I will give wes a go, as for adding it, it was previously supported in Jme3 then suddenly unsupported, I cannot recall the reasoning though, setting a negative speed now will mangle the model.

can you offer any advice on smoothing swapping animations mid play through when they share the same length like swap one animation at frame 14 and have the new one continue 15, 16, 17… (please note, I understand that jme’s system don’t function on the concept of frames per say, jus visualizing what I want to achieve)

my first post was actually two questions I messed it up by mixing up the paragraphs sorry

You can set negative speed using:

You can take a look at EffectControl and TweenAnimation from Lemur to see how it does this using the idea of channels.

And by the way, note that when you swap animation, transition to the new animation will already be smooth. You can control the transition using:

1 Like

noted on all counts thanks for this

Ok tried to get lemur via git but I keep hitting this wall with gradle…will the last release work with the current jme3 release, getting to understand what need to do from the source, Lemur on it’s own seems interesting though