Create a replay to pause, play and slow down

Good morning,
is possible in JME to create a replay from a model and a list of rotation of its bones?? I’m using JME to animate a model with data from body sensors to make a reconstruction of some movements. To analize these movements I need something similar to a replay: this because I need to pause the simulation, scan back and forward e slow down it.

Thanks for any idea. :blush:

1 Like

You can move bones through code, eg.:

Bone bone = skeleton.getBone("mybone");
Vector3f loc = rWheel.getLocation();
Quaternion rot = rWheel.getRotation();
Vector3f scale = rWheel.getScale();
//modify, make copies of these vectors, etc

bone.setUserControl(true);
bone.setUserTransforms(loc, rot, scale); 

Thus, what is left, is to store the data that you have used so you can play it back later, etc.

Thanks, I already move my bones from the code using an arraylist of Quaternions, I think I will make by myself the method to slow down the animation.

What about com.jme3.animation.AnimChannel.setSpeed(float speed) ?

As for the replay you could have a look at Cinematics especially the AnimationEvent. I don’t know if you can really skip through the animation but you can for example set the time of the cinematic so the animation would probably go back I think.

Thank you, I’ll try. Only a question, does setSpeed(float speed) and Cinematics function with custom animation? Because I move my bones with Quaternions values.

I am not sure as I haven’t worked with custom animations yet. But I don’t think it’ll work as you need to have an AnimChannel or AnimationControl and I don’t think you get that if you mofiy the bone positions directly. Sorry I didn’t quite get that you moved them directly…
I guess you’ll have to write your own methods then but again I’m not 100% sure.