Procházet zdrojové kódy

Added Object3D.setRotationFrom* routines

WestLangley před 12 roky
rodič
revize
b87ef38b95
1 změnil soubory, kde provedl 30 přidání a 0 odebrání
  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