Change color of a mesh loaded with PLYLoader

Hi,
I can’t change the color of the loaded mesh with PLYLoader. I can change color of other objects with dat.gui but not the mesh. You can view the CodePen below. Could you please help me out?

See the Pen Change color with dat.gui by brabbit640 (@brabbit640) on CodePen.

Thank you very much

Hi!
You didn’t put the mesh with that loaded geometry to the array you pass to the raycaster.
Just add it in the end of the callback function:

loader.load(
  "https://threejs.org/examples/models/ply/binary/Lucy100k.ply",
  function(geometry) {
    //geometry.computeVertexNormals();

    var mesh = new THREE.Mesh(geometry, meshMaterial);
    mesh.scale.multiplyScalar(0.04);
    mesh.position.x = 40;
    scene.add(mesh);
    objects.push(mesh); // this line
  }
);

2 Likes

Wow! You’re really good. Thanks so much. :raised_hands::+1::+1::+1:

You’re welcome :beers: :slight_smile:

1 Like