javascript - Three.js + Blender + ColladaLoader: undefined "geometry" and "material" (r71) -
i'm loading .dae scene (from blender) with:
var collada_loader = new three.colladaloader(); collada_loader.load( "resources/3d/objs.dae", function(collada) { obj1 = collada.scene.getchildbyname("obj1", true); obj1.position.set(0, 0, 0); obj1.material.color.sethex(0x003388); scene.add(obj1); obj2 = collada.scene.getchildbyname("obj2", true); obj2.position.set(100, 100, 100); obj2.material.color.sethex(0x003388); scene.add(obj2); obj3 = collada.scene.getchildbyname("obj3", true); obj3.position.set(-100, -100, -100); obj3.material.color.sethex(0x003388); scene.add(obj3); } );
but obj*.material , obj*.geometry properties undefined! why? found materials in loader's object , tried create mesh:
var collada_loader = new three.colladaloader(); collada_loader.load( "resources/3d/objs.dae", function(collada) { var obj1_mat = collada.dae.materials["obj1_mat-material"]; var obj1_geom = collada.dae.geometries["obj1_geom-mesh"]; obj1 = new three.mesh(obj1_geom, obj1_mat); obj1.position.set(0, 0, 0); obj1.material.color.sethex(0x003388); scene.add(obj1); var obj2_mat = collada.dae.materials["obj2_mat-material"]; var obj2_geom = collada.dae.geometries["obj2_geom-mesh"]; obj2 = new three.mesh(obj2_geom, obj2_mat); obj2.position.set(100, 100, 100); obj2.material.color.sethex(0x003388); scene.add(obj2); var obj3_mat = collada.dae.materials["obj3_mat-material"]; var obj3_geom = collada.dae.geometries["obj3_geom-mesh"]; obj3 = new three.mesh(obj3_geom, obj3_mat); obj3.position.set(-100, -100, -100); obj3.material.color.sethex(0x003388); scene.add(obj3); } );
but chrome writes:
uncaught typeerror: geometry.addeventlistener not function three.js:21479
wtf? solved problem! there three.colladaloader2() - works fine!
Comments
Post a Comment