Преглед на файлове

Merge pull request #14756 from Mugen87/dev2

Ray: Slightly optimize .intersectsSphere()
Mr.doob преди 7 години
родител
ревизия
0908b411fb
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  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 );
 
 	},