Raycaster: BufferGeometry with new Face3

I did some tests with Raycaster and indexedBufferGeometry.

According to the documentation


Raycaster .intersectObject
https://threejs.org/docs/index.html#api/core/Raycaster.intersectObject

faceIndex – index of the intersected face
indices – indices of vertices comprising the intersected face

When intersecting a Mesh with a BufferGeometry, the faceIndex will be undefined, and indices will be set; when intersecting a Mesh with a Geometry, indices will be undefined.


I have created output.

That was correct except for the indices.

20171213-1509-50726

In the source code
three.js/src/objects/Mesh.js (github .com /mrdoob/three.js/blob/master/src/objects/Mesh.js)
I found:

function checkBufferGeometryIntersection( …
if ( intersection ) {…
intersection.face = new Face3( a, b, c, Triangle.normal( vA, vB, vC ) );
intersection.faceIndex = a;

Then I took faceIndex and it works.

20171213-1515-50157

Addendum: A more complete edition:

20171213-2040-04675

BufferGeometry and Face3 :question:
I’m a little confused. :thinking: How do I get clear in my head again?

Looks like the docs are not correct. indices is no property of an intersection object. face and faceIndex should always contain valid data.

OK, I understand.

Is it safe to assume that Face 3 is on the spot

intersection. face = new Face3 (a, b, c, triangle. normal (vA, vB, vC);

will endured?

I thought Face3 was designed for Geometry.

I thought Face3 was designed for Geometry.

As you can see in the code, it is also used a general data structure for face information. And yes, i don’t think we will change this in the near future :wink:

BTW: We should definitely correct the docs to clarify the situation.