瀏覽代碼

Box3: Return 0,0,0 center if empty. See #9675

Mr.doob 9 年之前
父節點
當前提交
562ac3d442
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/math/Box3.js

+ 1 - 1
src/math/Box3.js

@@ -204,7 +204,7 @@ Box3.prototype = {
 	center: function ( optionalTarget ) {
 
 		var result = optionalTarget || new Vector3();
-		return result.addVectors( this.min, this.max ).multiplyScalar( 0.5 );
+		return this.isEmpty() ? result.set( 0, 0, 0 ) : result.addVectors( this.min, this.max ).multiplyScalar( 0.5 );
 
 	},