Ali_RS
October 28, 2020, 1:38pm
14
Yes, unfortunately, that will not work like that for the new system because in the new system a TansformTrack is keeping a reference to the Joint (Bone) of the model so you need to clone tracks (using jmeClone()) and update their target to refer to the joint of the new model.
See here for a solution
Yes, you need to instantiate a new AnimClip and TransformTrack.
Not sure why @Nehon designed it like this in the new animation system.
an example code for retargeting an AnimClip from one model to another model supposing both have the same rig :
Spatial model = assetManager.loadModel("models/character/model-1/model.gltf");
AnimComposer ac = getAnimComposer(model);
AnimClip clip = ac.getAnimClip("walk");
rootNode.attachChild(model);
model = assetManage…
Solved.
TransformTrack has a target that references to a Joint or Node (root), I needed to update the target to refer to the new model joints.
Or you can also use Wes library to retarget an animation
* Re-target the specified AnimClip from the specified source armature to
* the specified target armature using the specified map.
*
* @param sourceClip which AnimClip to re-target (not null, unaffected)
* @param sourceArmature (not null, unaffected)
* @param targetArmature (not null, unaffected)
* @param map the skeleton map to use (not null, unaffected)
* @param clipName name for the resulting AnimClip (not null)
* @return a new AnimClip
*/
public static AnimClip retargetAnimation(AnimClip sourceClip,
Armature sourceArmature, Armature targetArmature,
SkeletonMapping map, String clipName) {
Validate.nonNull(sourceArmature, "source armature");
Validate.nonNull(targetArmature, "target armature");
Validate.nonNull(map, "map");
Validate.nonNull(clipName, "clip name");
/*
* Start with an empty AnimClip.
*/
AnimClip result = new AnimClip(clipName);
3 Likes