Browse Source

Merge pull request #14756 from Mugen87/dev2

Ray: Slightly optimize .intersectsSphere()
Mr.doob 7 năm trước cách đây
mục cha
commit
0908b411fb
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  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 );
 
 	},