Bounding box and scale calculation problem

Hello, I have a problem with the bounding box and scale
I have this kind of case where

    const object = new THREE.Object3D()

    const geometry = new THREE.BoxBufferGeometry(1,1,1);
    const material =  new THREE.MeshPhongMaterial({color: 0x000000});
    const mesh = new THREE.Mesh(geometry, material);
    mesh.name = "Box"
    object.add(mesh)

    object.scale.set(5, 5, 5)

    const box_mesh = object.getObjectByName("Box")
    const box3 = new THREE.Box3().setFromObject(box_mesh);
    const length_x = box3.max.x - box3.min.x;
    const length_x = box3.max.y - box3.min.y;
    const length_z = box3.max.z - box3.min.z;

    const other_geometry = new THREE.BoxBufferGeometry(length_x, length_y, length_z);
    const other_material =  new THREE.MeshPhongMaterial({color: 0x000000});
    const other_mesh = new THREE.Mesh(geometry, material);
    other_mesh.position.y  = -2
    object.add(other_mesh)

In this case, after scaling the size of other_mesh is not the same as the box_mesh
it is bigger by 5 exactly as much as we scale it,
there is an option where I can do this length_x / object.scale.x
but I wonder IS THERE ANY OTHER WAY TO DO THIS WITH for example with help of Matrix

and one more additional question where I can find articles related to the use of Matrix in three.js

Advanced Tank You

1 Like