Browse Source

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

Mr.doob 9 years ago
parent
commit
562ac3d442
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/math/Box3.js

+ 1 - 1
src/math/Box3.js

@@ -204,7 +204,7 @@ Box3.prototype = {
 	center: function ( optionalTarget ) {
 	center: function ( optionalTarget ) {
 
 
 		var result = optionalTarget || new Vector3();
 		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 );
 
 
 	},
 	},