javascript - Cannot read property 'length' of undefined by loading object in Three.js -
i'm quite beginner in three.js. tried load simple cylinder.js object exported blender. but, got error
uncaught typeerror: cannot read property 'length' of undefined three.js:600 three.loader.initmaterials three.js:600 three.jsonloader.createmodel three.js:691 g.onreadystatechange
here's simple code
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)
i don't have idea should do. appreciate idea , help.
Comments
Post a Comment