Hello to all I begin in Three js, I would like that when my box enters in collision of my Mesh that all the polygons which are inside my Mesh change of color
Current result
here is my function which allows me to detect the collision of my 2 objects
detectCollisionObject(box) {
const meta = this.getMetaByModelUUID(this.state.meshes[0].uuid);
meta.mesh.children[0].geometry.computeBoundingBox(); //not needed if its already calculated
box.geometry.computeBoundingBox();
meta.mesh.children[0].updateMatrixWorld();
box.updateMatrixWorld();
var box1 = meta.mesh.children[0].geometry.boundingBox.clone();
box1.applyMatrix4(meta.mesh.children[0].matrixWorld);
var box2 = box.geometry.boundingBox.clone();
box2.applyMatrix4(box.matrixWorld);
// //return box1.intersectsBox(box2);
console.log("Collision", box1.intersectsBox(box2));
}
Here is a picture of what I would like to have
I thank you for your answer