我是Three.js的初学者。 我试图加载一个从Blender导出的简单的cylinder.js对象。 但是,我收到了这个错误
未捕获的TypeError:无法读取未定义的属性“length” Three.js:600 THREE.Loader.initMaterials Three.js:600 THREE.JSONLoader.createModel Three.js:691 g.onreadystatechange
这是我的简单代码
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(
75,
window.innerWidth / window.innerHeight,
0.1,
1000 );
camera.position.z = 300;
scene.add(camera);
var renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
var loader = new THREE.JSONLoader();
function createScene( geometry )
{
var materials = geometry.materials[0];
materials.morphTargets = true;
var material = new THREE.MeshFaceMaterial();
mesh = new THREE.Mesh( geometry, material );
mesh.scale.set(50, 50, 50);
scene.add( mesh );
}
loader.load('cylinder.js', createScene)
我真的不知道该怎么做。我很感激任何想法和帮助。