浏览代码

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