What is the meaning of faceIndex in the object returned by the raycaster?

I am calling the raycaster for a bunch of meshes in the scene.
Calling intersectObject in the raycaster results in a rich data structure of hit information…

distance – distance between the origin of the ray and the intersection
point – point of intersection, in world coordinates
face – intersected face
faceIndex – index of the intersected face
object – the intersected object
uv - U,V coordinates at point of intersection
uv1 - Second set of U,V coordinates at point of intersection
normal - interpolated normal vector at point of intersection
instanceId – The index number of the instance where the ray intersects the InstancedMesh 

Please clarify two things:
(1) Does face = triangle in bufferGeometry ?
(2) What does faceIndex mean?


The highlighted, orange parts are faces:

But, since three renders everything only using triangles (ie. any higher-vertex shape will be just split into triangles), you can indeed assume that a face is a triangle within the buffer geometry.

It’s the offset (ie. pointer to the first of 3 indexed vertices) within index buffer of an indexed buffer geometry (source.) It’s kinda irrelevant in day-to-day coding.

1 Like

That confirms what I had gathered. Thank you indeed!
BTW, did you use a three.js program to produce that pretty picture of the cube with rounded edges?
(The pic used to illustrate the meaning of “face”)
If so, is that code shareable?


It’s a screenshot from Blender in edit mode - https://www.blender.org/ :grin: