Upon loading a Ply file with PLYLoader
, I modify the mesh a little bit so it looks better:
loader.load(
filename,
function ( geometry ) {
var material = new THREE.MeshStandardMaterial( { color: 0x0055ff } );
geometry.dynamic = true;
var mesh = new THREE.Mesh( geometry, material );
mesh.position.set(x, y, z);
mesh.rotation.set(angleX, 0, 0);
mesh.scale.set( sFactor, sFactor, sFactor );
//mesh.updateMatrix();
//mesh.geometry.applyMatrix( mesh.matrix );
//mesh.geometry.verticesNeedUpdate = true;
scene.add( mesh );
});
This renders the mesh perfectly, but later on I need to access the vertices with the new values. I know that you have to update also the geometry, but I don't find the correct combination.
I have tried setting the geometry to "dynamic" and then applying the mesh.matrix
, as shown in the commented code. That makes the mesh render incorrectly (it's like it applied twice the transformation).
I'm doing something wrong but I don't find what. Does someone know how can update the geometry?