Hello, I have a problem. I have the following problem: there is a model without animation and there is an animation in .fbx format, downloaded from mixamo (without skin). I want to add animation from mixamo and run it on .glb model.
I was able to do this, but only on a model that I imported into mixamo and auto-rigged.
So I’m inclined to think that I need to work with the bones somehow (maybe load the model and copy those resulting bones?).
Here’s a little piece of code of how I do it (I hope it gives clarity to the picture).
Thank you all in advance for your help!
gltfLoader.load('https://www.dl.dropboxusercontent.com/s/ekfo3obceiyr1h2/avatar_ytdqb%20%281%29.glb?dl=1', function ( gltf ) {
const firstHelper = new THREE.SkeletonHelper( gltf.scene );
scene.add( firstHelper );
let obj = gltf.scene
obj.scale.set(100, 100, 100)
mixer = new THREE.AnimationMixer(obj);
scene.add( obj );
obj.name = "modelToAnimate"
gltf.animations; // Array<THREE.AnimationClip>
gltf.scene; // THREE.Group
gltf.scenes; // Array<THREE.Group>
gltf.cameras; // Array<THREE.Camera>
gltf.asset; // Object
console.log("@@@@@ LOAD GLB OBJECT", obj)
fbxLoader.load('./models/[email protected]',
function (object) {
object.name = "animation"
object.scale.set(0.01, 0.01, 0.01);
const animationAction = mixer.clipAction(
object.animations[0]
);
},
// called while loading is progressing
function (xhr){
console.log( ( xhr.loaded / xhr.total * 100 ) + '% animations\'s loaded' );
},
// called when loading has errors
function (error) {
console.error( 'An error happened', error );
}
);
},
// called while loading is progressing
function ( xhr ) {
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
},
// called when loading has errors
function ( error ) {
console.error( 'An error happened', error );
}
);