Copy Animations

First thing you did wrong is combining both methods. There is no need to use clone and addTargetedAnimation together. You have to stick to one way. Next is that in your first .glb-import, you unneccessarily cloned animationGroup and then you clone again in second .glb-import. Cloning in second would be enough here. Also you created an animationGroup, which is already imported, then you try to addTargetedAnimation to the createdAnimationGroup with importedAnimationGroup as animation and clonedAnimationGroup as target. Then you did this all again for second .glb-file with slight difference, that this time you iterate through targetedAnimations of first createdAnimationGroup with second ClonedAnimationGroup as target. Your parameters of clone-function missing targetConverter.

To make it short:
AnimationGroup != Animation
AnimationGroup != Target (Bone, Mesh)

At last you need to check if names are identical, found atleast one (RootNode !== RootNode1):

2 Likes