[Solved] Sharing Animation between several models

Hello Dear All,

From my tests it looks like in order for one animation to play on different .egg models , the full skeleton hierarchy should match between the two models.
ie : if one models have the same joints that the other, plus some additionnal (below in hiearchy) it will not work.
ex: model A arm1>forebone1>hand1
and model B arm1>forebone1>hand1>finger1

Am i right?

For information i do create the two models in .X format then convert them with
x2egg -model -a skeleton rogue#model.x rogue#model.egg
x2egg -model -a skeleton archer#model.x archer#model.egg
x2egg -anim -a skeleton archer#walk.x archer#walk.egg

This is correct. The skeletons should match exactly in order to guarantee they play correctly. (Sometimes you can get “lucky” and successfully play an animation that doesn’t match exactly, but this is risky.) However, you can use the egg-optchar command to fix animations that might be missing joints to match a particular skeleton.

This seems right to me. With “-a skeleton” you are giving all your models and animation channels the same name, “skeleton”, which implies that you intend to play this animation on either of these two models.

If the skeleton hierarchy almost matches, but does not quite match, you can usually fix them with a command like this:

egg-optchar -d output rogue#model.egg archer#model.egg archer#walk.egg

This will read in the three egg files, adjust them, and write out the modified egg files into the directory “output”. Even if your hierarchy does match exactly, it’s usually a good idea to pass all of your animations through egg-optchar, since it provides some performance benefit by removing unneeded joints (often 30-60% of the joints in a given skeleton are unneeded).