Can't use the traverse function of a .drc file

Hi!

I want to apply textures to my .drc file but I am unable to do so. I cant se the traverse function.

So

dracoLoader.load( 'assets/model/model.drc', function ( mesh) {
    mesh.traverse( function ( child ) {    <------ This will get me a error this error
 	console.log(child.name);                                                                          
 });                                                                                                          
      
      
Uncaught (in promise) TypeError: geometry.traverse is not a function
at script4.js:34
at THREE.DRACOLoader.decodeDracoFileInternal (DRACOLoader.js:139)
at DRACOLoader.js:108

I have tried to convert other models, but it is everytime the same error.
Should I keep in mind something while exporting the model from 3ds Max or am I doing something wrong here?

Thank you :slight_smile:

The draco loader returns a geometry and not a mesh – see this example: https://github.com/mrdoob/three.js/blob/master/examples/webgl_loader_draco.html#L85-L98

Thank you for the answer! :slight_smile:

But now, how can i load multiple materials in one geometry? Is there a way? I tried to pass the materials as a array

geometry = new THREE.Mesh(obj, [material1, material2]);

But nothing shows up, not even the model

Thank you again

I don’t think Draco supports materials, except for vertex colors. You’ll need to use another format for that, like glTF or FBX. Draco compression can be used inside of a glTF file, see https://threejs.org/docs/#examples/loaders/GLTFLoader. There’s a glTF exporter for 3DS Max if you need it: https://doc.babylonjs.com/resources/3dsmax_to_gltf

Or have you created the materials yourself in code? It’s not quite clear what you’re asking if so.

@zenel_bobi please show a complete code example that demonstrates your problem. Pasting in single lines is not enough to help you.