Browse Source

Merge remote-tracking branch 'motin/quaternion-lookat' into dev

Mr.doob 12 years ago
parent
commit
88dcf67133
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 ) {
 	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.copy(this.matrix.decompose()[1]);
+			
+		}
 
 
 	}
 	}
 
 

+ 9 - 1
src/core/Object3D.js

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