Three.js(r71) - 数据初始化问题

时间:2015-07-08 17:35:35

标签: three.js initialization

我收到错误:

  

TypeError:undefined不是对象(评估' data.initialized')

有人知道如何修复它吗?我正在使用three.js(r71),它已经修复了#5831 bug

2 个答案:

答案 0 :(得分:1)

直接查看您的json文件:geometry.animation是否存在? geometry.animations更可能?在这种情况下,它可能是一个数组,因此正确的参数是geometry.animations[0]

答案 1 :(得分:0)

loader = new THREE.JSONLoader();  
loader.load( 'models/SL-MD-avatar_erica68.json', addModel );

var helpset;
function addModel( geometry,  materials ){
    materials[0].skinning = true;
    objeto= new THREE.SkinnedMesh( geometry, new  THREE.MeshFaceMaterial(materials));
    objeto.setCastShadow = true;
    objeto.receiveShadow = true;

    scene.add(objeto);

    helpset = new THREE.SkeletonHelper(objeto);
    helpset.visible = false;
    scene.add(helpset);

    // Instantiate the animation

    var animation = new THREE.Animation(objeto, geometry.animation);

    // Start playing the animation
    animation.play();
}