Load one bone fbx file with animation information
I want to know how to connect multiple mesh files (head, body, tail, etc.) to a bone fbx file.
The problem is that the mesh fbx information is not connected to the bone fbx,
so the animation does not move.
I am wondering how to solve it.
fbxLoader.load(
‘Action_Angry_Ani.fbx’,
(object) => {
// Add Skeleton
let skeleton;
let bones = [];
skeleton = new THREE.SkeletonHelper( object );
skeleton.visible = true;
scene.add( skeleton );
// End Skeleton
let texture
let t = loadTGATexture('custom/tex/character.tga').then(result => {
texture = result;
});
Promise.all([t]).then(() => {
Promise.all([
fbxLoader.loadAsync('Body/Custom_Parts_Body_A_001.fbx'),
fbxLoader.loadAsync('Ear/Custom_Parts_Ear_A_001.fbx'),
fbxLoader.loadAsync('Eye/Custom_Parts_Eye_A_001.fbx'),
fbxLoader.loadAsync('Mouth/Custom_Parts_Mouth_A_001.fbx'),
fbxLoader.loadAsync('Tail/Custom_Parts_Tail_A_001.fbx'),
fbxLoader.loadAsync('Whisker/Custom_Parts_Whister_A_001.fbx'),
]).then((results) => {
[
Custom_Parts_Body001,
Custom_Parts_Ear001,
Custom_Parts_Eye001,
Custom_Parts_Mouth001,
const material = new THREE.MeshPhysicalMaterial( { map:texture } );
scene.material = texture
object.traverse( function ( node ) {
console.log("--->",node.name, node.type)
});
Custom_Parts_Body001.traverse( function ( node ) {
if ( node.isMesh ) {
node.material = material;
node.castShadow = true;
node.receiveShadow = false;
node.flatshading = true;
}
});
Custom_Parts_Ear001.traverse( function ( node ) {
if ( node.isMesh ) {
node.material = material;
node.castShadow = true;
node.receiveShadow = false;
node.flatshading = true;
}
});
Custom_Parts_Eye001.traverse( function ( node ) {
if ( node.isMesh ) {
node.material = material;
node.castShadow = true;
node.receiveShadow = false;
node.flatshading = true;
}
});
Custom_Parts_Mouth001.traverse( function ( node ) {
if ( node.isMesh ) {
node.material = material;
node.castShadow = true;
node.receiveShadow = false;
node.flatshading = true;
}
});
Custom_Parts_Tail001.traverse( function ( node ) {
if ( node.isMesh ) {
node.material = material;
node.castShadow = true;
node.receiveShadow = false;
node.flatshading = true;
}
});
Custom_Parts_Whisker001.traverse( function ( node ) {
if ( node.isMesh ) {
node.material = material;
node.castShadow = true;
node.receiveShadow = false;
node.flatshading = true;
}
});
object.children[0].children[0].children[1].attach(Custom_Parts_Body001)
object.children[0].children[0].children[0].attach(Custom_Parts_Ear001)
object.children[0].children[0].children[0].attach(Custom_Parts_Eye001)
object.children[0].children[0].children[0].attach(Custom_Parts_Mouth001)
object.children[0].children[0].children[0].attach(Custom_Parts_Tail001)
object.updateMatrix()
scene.add(object)
let clips = object.animations
console.log('clips' , clips)
clips.forEach( function ( clip ) {
console.log("clip", clip)
mixer.clipAction( clip ).play();
} );
});
})
},
(xhr) => {
console.log((xhr.loaded / xhr.total) * 100 + '% loaded')
},
(error) => {
console.log(error)
}
)