Переглянути джерело

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 );
 
 	},