Browse Source

Fixed Vector3.projectOnVector.

Mr.doob 11 years ago
parent
commit
9e74321a3c
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/math/Vector3.js

+ 4 - 2
src/math/Vector3.js

@@ -597,7 +597,7 @@ THREE.Vector3.prototype = {
 
 	projectOnVector: function () {
 
-		var v1;
+		var v1, dot;
 
 		return function ( vector ) {
 
@@ -605,7 +605,9 @@ THREE.Vector3.prototype = {
 
 			v1.copy( vector ).normalize();
 
-			return this.copy( v1 ).multiplyScalar( this.dot( v1 ) );
+			dot = this.dot( v1 );
+
+			return this.copy( v1 ).multiplyScalar( dot );
 
 		};