|
@@ -60,7 +60,7 @@
|
|
// Checking boundingSphere distance to ray
|
|
// Checking boundingSphere distance to ray
|
|
sphere.set(
|
|
sphere.set(
|
|
object.matrixWorld.getPosition(),
|
|
object.matrixWorld.getPosition(),
|
|
- object.geometry.boundingSphere.radius* object.matrixWorld.getMaxScaleOnAxis() );
|
|
|
|
|
|
+ object.geometry.boundingSphere.radius * object.matrixWorld.getMaxScaleOnAxis() );
|
|
|
|
|
|
if ( ! raycaster.ray.isIntersectionSphere( sphere ) ) {
|
|
if ( ! raycaster.ray.isIntersectionSphere( sphere ) ) {
|
|
|
|
|
|
@@ -86,7 +86,7 @@
|
|
inverseMatrix.getInverse( object.matrixWorld );
|
|
inverseMatrix.getInverse( object.matrixWorld );
|
|
|
|
|
|
localRay.copy( raycaster.ray ).transform( inverseMatrix );
|
|
localRay.copy( raycaster.ray ).transform( inverseMatrix );
|
|
-
|
|
|
|
|
|
+
|
|
for ( var f = 0, fl = geometry.faces.length; f < fl; f ++ ) {
|
|
for ( var f = 0, fl = geometry.faces.length; f < fl; f ++ ) {
|
|
|
|
|
|
var face = geometry.faces[ f ];
|
|
var face = geometry.faces[ f ];
|
|
@@ -94,14 +94,14 @@
|
|
var material = isFaceMaterial === true ? objectMaterials[ face.materialIndex ] : object.material;
|
|
var material = isFaceMaterial === true ? objectMaterials[ face.materialIndex ] : object.material;
|
|
|
|
|
|
if ( material === undefined ) continue;
|
|
if ( material === undefined ) continue;
|
|
-
|
|
|
|
|
|
+
|
|
facePlane.setFromNormalAndCoplanarPoint( face.normal, vertices[face.a] );
|
|
facePlane.setFromNormalAndCoplanarPoint( face.normal, vertices[face.a] );
|
|
|
|
|
|
var planeDistance = localRay.distanceToPlane( facePlane );
|
|
var planeDistance = localRay.distanceToPlane( facePlane );
|
|
-
|
|
|
|
|
|
+
|
|
// bail if raycaster and plane are parallel
|
|
// bail if raycaster and plane are parallel
|
|
if ( Math.abs( planeDistance ) < precision ) continue;
|
|
if ( Math.abs( planeDistance ) < precision ) continue;
|
|
-
|
|
|
|
|
|
+
|
|
// if negative distance, then plane is behind raycaster
|
|
// if negative distance, then plane is behind raycaster
|
|
if ( planeDistance < 0 ) continue;
|
|
if ( planeDistance < 0 ) continue;
|
|
|
|
|
|
@@ -117,7 +117,7 @@
|
|
|
|
|
|
// this can be done using the planeDistance from localRay because localRay wasn't normalized, but ray was
|
|
// this can be done using the planeDistance from localRay because localRay wasn't normalized, but ray was
|
|
if ( planeDistance < raycaster.near || planeDistance > raycaster.far ) continue;
|
|
if ( planeDistance < raycaster.near || planeDistance > raycaster.far ) continue;
|
|
-
|
|
|
|
|
|
+
|
|
intersectPoint = localRay.at( planeDistance, intersectPoint ); // passing in intersectPoint avoids a copy
|
|
intersectPoint = localRay.at( planeDistance, intersectPoint ); // passing in intersectPoint avoids a copy
|
|
|
|
|
|
if ( face instanceof THREE.Face3 ) {
|
|
if ( face instanceof THREE.Face3 ) {
|