Reuse animation files

What is the best way to reuse animation files ?

I was thinking to export one character, and reuse the AnimControl object (clone it) for every character with the same rig.

Does this work or are there better approaches?

could you write more precise? what do you want to achieve?

Ok,

I have about 20 animations that I want to use in my game and 20 characters. I do not want to store those 20 animations in every character. Instead I would like to use a “prototype” character, and load all the animations that I need from this prototype character.

Hope this makes it clear.

This has been posted just a few days ago :

@diener175 said: This helped. All you gotta do is create a mesh for your character with a skeleton and create a mesh for your clothes with the SAME skeleton. You can then use the same animation on both your channel for the clothes and your channel for the player. http://hub.jmonkeyengine.org/forum/topic/character-and-equipment-animation-for-many-nodes-using-only-1-skeleton/

Thx yang, but it is not what I want to do. But I will try out my method and report back :wink:

So maybe you have not explained your point clearly enough. I thought you wanted to use several animations with several objects.

dont’ know if JME cashe it, because it would not be hard when JME have cashe mesh/etc in assetLoader.

if not, then your idea is ok. you just need to have other channels to avoid setting active animation to ALL characters :smiley:

i was fighting with that months ago to make a character creator. but i still were storing many duplicated animations data(if JME do not cashe it).

so, first, you should ask Dev, or look into JME source, if animations are cashed or not.

Re-targeting of animations is a complex topic. Its not implemented/available as easy as you imagine it. If you want to implement BVH retargeting or something, you’re welcome to share what you come up with :slight_smile:

Just actually using the same animation for a model that is exactly the same should be a breeze though, just look at the animation classes’ code if you don’t see how from looking at the class structure.

1 Like

Yeah retargeting an animation to a different skeleton is a pain. Must be doable, but I failed quite some time ago.

However, what you can do is to make 1 model with a skeleton and animations (in blender or w/e). All the other models with the EXACT same skeleton with no animations.
Then you just have to add the animation taken from the reference model to the other models
[java]
modelN.getControl(AnimControl.class).addAnim(model1.getControl(AnimControl.class).getAnim(“myAnim”)));
[/java]

2 Likes