Hi There!
Any reason why a simple animation might not be working on Threejs?
FBX Loading
const loader = new FBXLoader();
loader.load('/Brickz.fbx', (fbx) => {
//play Running animation
const mixer = new THREE.AnimationMixer(fbx);
animationsMixers[fbx.uuid] = {
mixer: mixer,
animations: {}
};
for (const key in fbx.animations) {
const animation = fbx.animations[key];
if (animation.name === 'Armature|Running') {
console.log(animation);
animationsMixers[fbx.uuid].animations[animation.name] = animation;
}
}
if (animationsMixers[fbx.uuid].animations['Armature|Running']) {
const animation = animationsMixers[fbx.uuid].animations['Armature|Running'];
const action = mixer.clipAction(animation);
animationActions['Armature|Running'] = action;
action.play();
}
fbx.scale.setScalar(0.01);
fbx.position.set(0, -2, 0);
fbx.castShadow = true;
fbx.receiveShadow = true;
fbx.traverse((item) => {
if (item.isMesh) {
item.castShadow = true;
item.receiveShadow = true;
item.material = material
}
});
group.add(fbx);
});
Animation loop
const animate = () => {
requestAnimationFrame(animate);
const delta = clock.getDelta();
for (const uuid in animationsMixers) {
const animationMixer = animationsMixers[uuid];
if (animationMixer) {
animationMixer.mixer.update(delta);
}
}
controls.update();
composer.render();
}
animate();
Video and more detail here:
https://www.reddit.com/r/threejs/comments/18tjyqm/fbx_animation_works_on_unity_autodesk_viewer_but/