Browse Source

fix copy() methods in Box3, Plane and Sphere to actually copy objects rather than just references.

Ben Houston 12 years ago
parent
commit
f7991d8336
3 changed files with 6 additions and 6 deletions
  1. 2 2
      src/core/Box3.js
  2. 2 2
      src/core/Plane.js
  3. 2 2
      src/core/Sphere.js

+ 2 - 2
src/core/Box3.js

@@ -79,8 +79,8 @@ THREE.Box3.prototype = {
 
 	copy: function ( box ) {
 
-		this.min = box.min;
-		this.max = box.max;
+		this.min.copy( box.min );
+		this.max.copy( box.max );
 
 		return this;
 	},

+ 2 - 2
src/core/Plane.js

@@ -50,8 +50,8 @@ THREE.Plane.prototype = {
 
 	copy: function ( plane ) {
 
-		this.normal = plane.normal;
-		this.constant = plane.constant;
+		this.normal.copy( plane.normal );
+		this.constant = plane.constant.clone();
 
 		return this;
 	},

+ 2 - 2
src/core/Sphere.js

@@ -37,8 +37,8 @@ THREE.Sphere.prototype = {
 
 	copy: function ( sphere ) {
 
-		this.center = sphere.center;
-		this.radius = sphere.radius;
+		this.center.copy( sphere.center );
+		this.radius = sphere.radius.clone();
 
 		return this;
 	},