For the performance purpose, in my case I mergerd cell shape as one buffergeometry. My question is while I raycaster one of cells and get the following content
distance: 0.5163975193122629
face: t {a: 5434, b: 5433, c: 5440, normal: t, vertexNormals: Array(0), …}
faceIndex: 4738
object: Un {uuid: ‘04E2D3A2-59F6-4CE0-AF94-003A0E9E13DD’, name: ‘rois’, type: ‘Mesh’, parent: e, children: Array(0), …}
point: t {x: 0.16790426007605952, y: 0.3279409435830404, z: 0, isVector3: true}
uv: t {x: 0.16790426007605952, y: 0.3279409435830404, isVector2: true}
[[Prototype]]: Object
Can I use faceIndex to get the exacti one of the cell?
I created a range dictionary by myself like this
roisDictionary.push([roisName, count - rois.data[roisName].length, rois.data[roisName].length]);
So I can compare whether the faceIndex is in one of the ranges
let faceIndex = genes.raycaster_points.filter(x => x.object.type === 'Mesh')[0].faceIndex;
roisDictionary.forEach(item => {
if (faceIndex > item[1] && faceIndex < (item[1] + item[2])) {
mouseHoveredRoisIdx = faceIndex;
if (!cellName.includes(item[0])) {
cellName.push(item[0]);
mouseHoveredRoisName = item[0];
generatorHoveredCell(item[0]);
}
}
})
I did the implementation like this, but while the mouse hoverd the cell, it is the another cell, seeems this is not the correct way to use faceIndex.