Sfoglia il codice sorgente

Add Quaternion dot() method instead of converting to Vector4

Leo Singer 11 anni fa
parent
commit
84f7367ac6
2 ha cambiato i file con 7 aggiunte e 1 eliminazioni
  1. 1 1
      examples/js/controls/OrbitControls.js
  2. 6 0
      src/math/Quaternion.js

+ 1 - 1
examples/js/controls/OrbitControls.js

@@ -98,7 +98,7 @@ THREE.OrbitControls = function ( object, domElement ) {
 	var pan = new THREE.Vector3();
 
 	var lastPosition = new THREE.Vector3();
-	var lastQuaternion = new THREE.Vector4();
+	var lastQuaternion = new THREE.Quaternion();
 
 	var STATE = { NONE : -1, ROTATE : 0, DOLLY : 1, PAN : 2, TOUCH_ROTATE : 3, TOUCH_DOLLY : 4, TOUCH_PAN : 5 };
 

+ 6 - 0
src/math/Quaternion.js

@@ -313,6 +313,12 @@ THREE.Quaternion.prototype = {
 
 	},
 
+	dot: function ( v ) {
+
+		return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;
+
+	},
+
 	lengthSq: function () {
 
 		return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;