Browse Source

Removing position behind origin check.

Mr.doob 13 years ago
parent
commit
0a10d079c3
1 changed files with 2 additions and 4 deletions
  1. 2 4
      src/core/Ray.js

+ 2 - 4
src/core/Ray.js

@@ -56,7 +56,7 @@ THREE.Ray = function ( origin, direction ) {
 
 
 			var distance = distanceFromIntersection( this.origin, this.direction, object.matrixWorld.getPosition() );
 			var distance = distanceFromIntersection( this.origin, this.direction, object.matrixWorld.getPosition() );
 
 
-			if ( distance === null || distance > object.scale.x ) {
+			if ( distance > object.scale.x ) {
 
 
 				return [];
 				return [];
 
 
@@ -79,7 +79,7 @@ THREE.Ray = function ( origin, direction ) {
 
 
 			var distance = distanceFromIntersection( this.origin, this.direction, object.matrixWorld.getPosition() );
 			var distance = distanceFromIntersection( this.origin, this.direction, object.matrixWorld.getPosition() );
 
 
-			if ( distance === null || distance > object.geometry.boundingSphere.radius * Math.max( object.scale.x, Math.max( object.scale.y, object.scale.z ) ) ) {
+			if ( distance > object.geometry.boundingSphere.radius * Math.max( object.scale.x, Math.max( object.scale.y, object.scale.z ) ) ) {
 
 
 				return intersects;
 				return intersects;
 
 
@@ -179,8 +179,6 @@ THREE.Ray = function ( origin, direction ) {
 		v0.sub( position, origin );
 		v0.sub( position, origin );
 		dot = v0.dot( direction );
 		dot = v0.dot( direction );
 
 
-		if ( dot <= 0 ) return null; // check if position behind origin.
-
 		intersect = v1.add( origin, v2.copy( direction ).multiplyScalar( dot ) );
 		intersect = v1.add( origin, v2.copy( direction ).multiplyScalar( dot ) );
 		distance = position.distanceTo( intersect );
 		distance = position.distanceTo( intersect );