Is there a way to get the updated bounding box of a mesh after transforming it

I have a wall mesh like so that I get the bounding box of. However the bounding box is of the original mesh, not after the transforms. Is there a way to get the bounding box of a transformed mesh?

    const planeMesh = new THREE.Mesh(planeGeometry, planeMaterial);

    planeMesh.translateX(middleX);
    planeMesh.translateY(wallHeightOver2);
    planeMesh.translateZ(middleZ);

    if (x1Position == x2Position) {
      planeMesh.rotateY(Math.PI / 2);
    };

    console.log(planeMesh);

    // maybe planeMesh.geometry doesn't update?
    planeMesh.geometry.computeBoundingBox();
    wallHitBoxes.push(planeMesh.geometry.boundingBox);

    scene.add(planeMesh);

Try planeMesh.updateMatrix() before computing the bbox

I just tried it but the bounding box data is the same.

Easiest to help is if you provide a jsFiddle which shows your problem.

What do you wanna achieve?

what is wallHitBoxes?

Try to use Box3. Note this post


let bbox = new THREE.Box3().setFromObject(planeMesh)
let size = new THREE.Vector3()
bbox.getSize(size)