Sfoglia il codice sorgente

Merge pull request #6302 from pavelvasev/dev

BufferGeometry: return the number of hit triangle in raycast
Ricardo Cabello 10 anni fa
parent
commit
6f6f7bf5d8
1 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. 3 3
      src/objects/Mesh.js

+ 3 - 3
src/objects/Mesh.js

@@ -159,9 +159,9 @@ THREE.Mesh.prototype.raycast = ( function () {
 							distance: distance,
 							point: intersectionPoint,
 							face: new THREE.Face3( a, b, c, THREE.Triangle.normal( vA, vB, vC ) ),
-							faceIndex: null,
+							faceIndex: Math.floor(i/3), // triangle number in indices buffer semantics
 							object: this
-
+							
 						} );
 
 					}
@@ -205,7 +205,7 @@ THREE.Mesh.prototype.raycast = ( function () {
 						distance: distance,
 						point: intersectionPoint,
 						face: new THREE.Face3( a, b, c, THREE.Triangle.normal( vA, vB, vC ) ),
-						faceIndex: null,
+						index: Math.floor(i/3), // triangle number in positions buffer semantics
 						object: this
 
 					} );