Преглед изворни кода

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