Explorar o código

Ray: Slightly optimize .intersectsSphere()

Mugen87 %!s(int64=7) %!d(string=hai) anos
pai
achega
8288ae7c33
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/math/Ray.js

+ 1 - 1
src/math/Ray.js

@@ -290,7 +290,7 @@ Object.assign( Ray.prototype, {
 
 	intersectsSphere: function ( sphere ) {
 
-		return this.distanceToPoint( sphere.center ) <= sphere.radius;
+		return this.distanceSqToPoint( sphere.center ) <= ( sphere.radius * sphere.radius );
 
 	},