Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Animation 使用three.js设置混合器模型的动画_Animation_Three.js_Blender - Fatal编程技术网

Animation 使用three.js设置混合器模型的动画

Animation 使用three.js设置混合器模型的动画,animation,three.js,blender,Animation,Three.js,Blender,我正在尝试使用three.js设置从blender导出的模型的动画。我使用blender的three.js导出脚本导出模型并导出整个几何体,我选择骨骼动画:姿势、嵌入动画、场景、层次和导出纹理。在js文件中,我使用ObjectLoad加载模型。当我尝试为模型设置动画时,我收到一个错误:“无法绑定到骨骼,因为节点没有骨架”,即使模型显然有骨架 以下是用于将模型添加到场景的函数: function addModelToScene(object) { var material = new T

我正在尝试使用three.js设置从blender导出的模型的动画。我使用blender的three.js导出脚本导出模型并导出整个几何体,我选择骨骼动画:姿势、嵌入动画、场景、层次和导出纹理。在js文件中,我使用ObjectLoad加载模型。当我尝试为模型设置动画时,我收到一个错误:“无法绑定到骨骼,因为节点没有骨架”,即使模型显然有骨架

以下是用于将模型添加到场景的函数:

function addModelToScene(object) {

    var material = new THREE.MeshPhongMaterial({
        color: 0xff0000,
        specular: 0x111111,
        shininess: 50,
        morphTargets: true
    });
    material.skinning = true;
    object.scale.x = object.scale.y = object.scale.z = 3;
    object.rotation.y += Math.PI / 1;
    object.rotation.x += Math.PI / 2;
    object.rotation.z += Math.PI / 1;

    object.traverse(function(child) {
        if (child instanceof THREE.Mesh) {
            child.material = material;
            animation = child.geometry.animations[0];
            mixer.clipAction(animation, child).play();
        }
    });

    mixer.clipAction(animation).play();

    scene.add(object);
}
此处为完整JSFIDLE:(可能需要一段时间才能加载)

我正在使用three.js和blender的最新版本