Three JS how to add color and line thickness to mesh loaded with GLTFLoader

283 views Asked by At

So far I managed to load a mesh with GLTFLoader and turn it into a wireframe. I'm stuck at the part where I want to color it and give it a line thickness. I don't completely understand how to use traverse().

My code so far:

var loader = new THREE.GLTFLoader(); loader.load('model.glb', handle_load);

var mesh;

function handle_load(gltf) {
  mesh = gltf.scene;
  mesh.traverse((node) => {
    if (!node.isMesh) return;
    node.material.wireframe = true;
  });
  scene.add(mesh);
  mesh.position.z = 2;
}
0

There are 0 answers