Seeking a more efficient method to locate neighboring faces that share the same edge within my PlaneBufferGeometry
. Currently, my THREE.Raycaster
is able to intersect with my object effectively using intersectObject
. However, I am in need of finding all adjoining faces.
My current approach involves a somewhat crude method of identifying nearby faces. While it serves its purpose in my specific scenario, it doesn't feel like the ideal solution:
let rc = new THREE.Raycaster();
let intersects = [];
for (let i = -1; i <= 1; i++) {
for (let j = -1; j <= 1; j++) {
let v = new THREE.Vector3(x + i, y, z + j);
rc.set(v, new THREE.Vector3(0, -1, 0));
rc.near = 0;
rc.far = 2;
let subIntersects = rc.intersectObject(mesh);
for (let n = 0; n < subIntersects.length; n++) {
intersects.push(subIntersects[n]);
}
}
}
Is there a quicker way, perhaps involving
mesh.geometry.attributes.position.array
, to identify these faces? Any suggestions or insights would be greatly appreciated. Thank you in advance!