Load a obj file
const loader = new OBJLoader(manager);
loader.load('models/obj/building/111.obj', function (obj) {
let i = 0;
obj.traverse(function (child) {
if (child.isMesh) {
child.name = 'building' + i.toString()
child.material = mat1
// child.castShadow = true;
//child.receiveShadow = true;
i = i + 1;
buildings.push(child)
}
});
scene.add(obj);
}, onProgress, onError);
function onPointerMove(event) {
pointer.x = (event.clientX / renderer.domElement.clientWidth) * 2 - 1;
pointer.y = - (event.clientY / renderer.domElement.clientHeight) * 2 + 1;
raycaster.setFromCamera(pointer, camera);
let intersects = raycaster.intersectObjects(buildings);
if (intersects.length > 0) {
intersects[0].face.color.setHex(0x1111)
//I got face,but the face has no color attribute. i want to change color of this face,how?
}
}
I only want to change the color of face,not mesh. how? thanks.