Browse Source

Working lookat() also when useQuaternion = true

Fredrik Wollsén 12 years ago
parent
commit
d108bf021e
2 changed files with 18 additions and 2 deletions
  1. 9 1
      src/cameras/Camera.js
  2. 9 1
      src/core/Object3D.js

+ 9 - 1
src/cameras/Camera.js

@@ -24,7 +24,15 @@ THREE.Camera.prototype.lookAt = function ( vector ) {
 
 	if ( this.rotationAutoUpdate === true ) {
 
-		this.rotation.setEulerFromRotationMatrix( this.matrix, this.eulerOrder );
+		if ( this.useQuaternion === false )  {
+			
+			this.rotation.setEulerFromRotationMatrix( this.matrix, this.eulerOrder );
+			
+		} else {
+			
+			this.quaternion.setFromRotationMatrix( this.matrix );
+			
+		}
 
 	}
 

+ 9 - 1
src/core/Object3D.js

@@ -114,7 +114,15 @@ THREE.Object3D.prototype = {
 
 		if ( this.rotationAutoUpdate ) {
 
-			this.rotation.setEulerFromRotationMatrix( this.matrix, this.eulerOrder );
+			if ( this.useQuaternion === false )  {
+
+				this.rotation.setEulerFromRotationMatrix( this.matrix, this.eulerOrder );
+
+			} else {
+
+				this.quaternion.setFromRotationMatrix( this.matrix );
+
+			}
 
 		}