Browse Source

Merge remote-tracking branch 'WestLangley/dev-convenience' into dev

Mr.doob 12 years ago
parent
commit
8153c2c42b
1 changed files with 30 additions and 0 deletions
  1. 30 0
      src/core/Object3D.js

+ 30 - 0
src/core/Object3D.js

@@ -105,6 +105,36 @@ THREE.Object3D.prototype = {
 
 	}(),
 
+	setRotationFromAxisAngle: function ( axis, angle ) {
+
+		// assumes axis is normalized
+
+		this.quaternion.setFromAxisAngle( axis, angle );
+
+	},
+
+	setRotationFromEuler: function ( euler ) {
+
+		this.quaternion.setFromEuler( euler, true );
+
+	},
+
+	setRotationFromMatrix: function ( m ) {
+
+		// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
+
+		this.quaternion.setFromRotationMatrix( m );
+
+	},
+
+	setRotationFromQuaternion: function ( q ) {
+
+		// assumes q is normalized
+
+		this.quaternion.copy( q );
+
+	},
+
 	rotateOnAxis: function() {
 
 		// rotate object on axis in object space