void ent_anim_copy(ENTITY* eTarget, ENTITY* eSource)
{
int i,numBones,hparent;
ANGLE angle,angle2,angle3,eSourcePanInv;
numBones = ent_bones(eSource);
ent_bonereset_all(eTarget);
ang_diff(&eSourcePanInv,nullvector,&(eSource->pan));
for(i = 0; i < numBones; i++)
{
ang_for_bone(&angle,eSource,i+1); // use bone handles/ indices instead of names
ang_add(&angle,&eSourcePanInv);
hparent = ent_boneparent(eSource,NULL,i+1);
if(hparent > 0)
{
ang_for_bone(&angle2,eSource,hparent); // eTarget's bone is already rotated by parent bone's rotation => undo it!
ang_add(&angle2,&eSourcePanInv);
ang_diff(&angle3,nullvector,&angle2); // best way to do this? I doubt it.
ang_add(&angle,&angle3);
}
ent_bonerotate(eTarget,i+1,&angle);
}
}