I am trying to get an immediate real-time intersection. So, I want “intersection” to be printed in the console when the window bounding box intersects with the wall bounding box. However, I noticed that the window box is one move late. So, the first time I put the window in the wall, not instersection is captured. I need to move the window for a second time in the wall so I get the intersection printed in the console.

Does someone know what is the problem?

I have been trying to update the boxes, but the issue persists.

Here is the code:

```
private wallWindowIntersection(window, walls) {
let intersection = false;
// Compute the bounding sphere for the window
const meshesWindow = window.meshes[0];
meshesWindow.updateMatrixWorld(true);
const windowBoundingBox = new THREE.Box3();
const min = new THREE.Vector3(
adjustedCenter.x - width / 2,
adjustedCenter.y - height / 2,
adjustedCenter.z - depth / 2
);
const max = new THREE.Vector3(
adjustedCenter.x + width / 2,
adjustedCenter.y + height / 2,
adjustedCenter.z + depth / 2
);
windowBoundingBox.set(min, max);
windowBoundingBox.applyMatrix4(meshesWindow.matrixWorld);
const boxHelper = new THREE.Box3Helper(windowBoundingBox, 0x00ff00);
scene.add(boxHelper);
const meshesWall = wall.meshes[0];
meshesWall.updateMatrixWorld(true);
const boundingBoxWall = new THREE.Box3().setFromObject(meshesWall);
const wallHelper = new THREE.BoxHelper(meshesWall, 0x00ff00);
this.world.scene.three.add(wallHelper);
if (windowBoundingBox.intersectsBox(boundingBoxWall)) {
intersection = true;
console.log("INTERSECTION", intersection);
break;
}
}
return intersection;
}
```

I am learning three.js, so I am a beginner. I apologize if the question is idiot.