My javascript skills are limited, but I can get basic things working in threejs. Currently, I am struggling with the Draco exporter.
The Threejs.org website has an example of the Draco exporter
This example demonstrates exporting a generated mesh and it is functioning perfectly:
// export mesh
var geometry = new THREE.TorusKnotBufferGeometry( 50, 15, 200, 30 );
var material = new THREE.MeshPhongMaterial( { color: 0x00ff00 } );
mesh = new THREE.Mesh( geometry, material );
mesh.castShadow = true;
mesh.position.y = 25;
scene.add( mesh );
I am able to import the .obj file successfully as well
new OBJLoader()
.setPath( '../models/mymodel/' )
.load( 'mymodel.obj', function ( mesh ) {
mesh.traverse( function ( child ) {
if(child.name=='mymodel_part1'){
child.material = Material1;
}
if(child.name=='mymodel_part2'){
child.material = Material2;
}
if(child.name=='mymodel_part3'){
child.material = Material3;
}
} );
scene.add( mesh );
} );
However, when I try to export the mesh, it's not working and I receive a "TypeError: mesh is undefined".
It seems like the type is incorrect, but I am unsure what it should be and how to make the necessary changes.