Transformation of geometry

    let index = Math.floor(Math.random() * trashModels.length);
    let model = trashModels[index].scene.clone();

    let trash = model.children[1] as Object3D;
    let trashMesh = trash.children[0] as Mesh<BufferGeometry, MeshStandardMaterial>;
    render.scene.attach(trashMesh);
    trashMesh.position.set(0, 0, 0);
    // this is useful
    // trashMesh.scale.multiplyScalar(0.1);
    let geometry = trashMesh.geometry.clone() as BufferGeometry;
    let material = trashMesh.material.clone() as MeshStandardMaterial;
    // it's useless
    // geometry.scale(0.1, 0.1, 0.1);

    let mesh = new InstancedMesh(geometry, material, 10);
    mesh.instanceMatrix.setUsage(DynamicDrawUsage);
    mesh.castShadow = true;
    mesh.position.set(0, 2, 0);
    mesh.add(new AxesHelper(10));
    render.scene.attach(mesh);

Why do I have no use for changes in geometry, whether scaling, moving or rotating. By the way, I also want to know how to make the center of mass of the geometry be at the origin. My current geometry is offset in InstancedMesh.

Hi, can anyone take a look at my problem? Thanks in advance.

    geometry.computeBoundingBox();
    const bbox = geometry.boundingBox;
    const ox = (bbox.min.x + bbox.max.x) / 2;
    const oy = (bbox.min.y + bbox.max.y) / 2;
    const oz = (bbox.min.z + bbox.max.z) / 2;

    geometry.translate(-ox, -oy, -oz);


When I moved the geometry of a very deep sub-mesh in a model to the origin, it became like this.

it was originally like this

To modify an instanced mesh you should create a mock Object3D, apply transformations to it, then save the resulting matrix into the instances matrix - see this example. Keep in mind you have to do it every time you’d like to update the transformation of any instance.