Explorar o código

Fixed Vector3.projectOnVector.

Mr.doob %!s(int64=11) %!d(string=hai) anos
pai
achega
9e74321a3c
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  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 );
 
 		};