浏览代码

Changes order of reported orientation values

Diego Marcos 11 年之前
父节点
当前提交
ff0b145680
共有 1 个文件被更改,包括 6 次插入6 次删除
  1. 6 6
      examples/js/controls/VRControls.js

+ 6 - 6
examples/js/controls/VRControls.js

@@ -23,7 +23,7 @@ THREE.VRControls = function ( camera, done ) {
 				if ( devices[i] instanceof PositionSensorVRDevice ) {
 				if ( devices[i] instanceof PositionSensorVRDevice ) {
 					vrInput = devices[i]
 					vrInput = devices[i]
 					self._vrInput = vrInput;
 					self._vrInput = vrInput;
-					break; // We keep the firs we encounter
+					break; // We keep the first we encounter
 				}
 				}
 			}
 			}
 			if ( done ) {
 			if ( done ) {
@@ -47,10 +47,10 @@ THREE.VRControls = function ( camera, done ) {
 		// Applies head rotation from sensors data.
 		// Applies head rotation from sensors data.
 		if ( camera ) {
 		if ( camera ) {
 			quat = new THREE.Quaternion(
 			quat = new THREE.Quaternion(
+				vrState.hmd.rotation[0],
 				vrState.hmd.rotation[1],
 				vrState.hmd.rotation[1],
 				vrState.hmd.rotation[2],
 				vrState.hmd.rotation[2],
-				vrState.hmd.rotation[3],
-				vrState.hmd.rotation[0]
+				vrState.hmd.rotation[3]
 			);
 			);
 			camera.setRotationFromQuaternion( quat );
 			camera.setRotationFromQuaternion( quat );
 		}
 		}
@@ -60,17 +60,17 @@ THREE.VRControls = function ( camera, done ) {
 		var vrInput = this._vrInput;
 		var vrInput = this._vrInput;
 		var orientation;
 		var orientation;
 		var vrState;
 		var vrState;
-		if (!vrInput) {
+		if ( !vrInput ) {
 			return null;
 			return null;
 		}
 		}
 		orientation	= vrInput.getState().orientation;
 		orientation	= vrInput.getState().orientation;
 		vrState = {
 		vrState = {
 			hmd : {
 			hmd : {
 				rotation : [
 				rotation : [
-					orientation.w,
 					orientation.x,
 					orientation.x,
 					orientation.y,
 					orientation.y,
-					orientation.z
+					orientation.z,
+					orientation.w
 				]
 				]
 			}
 			}
 		};
 		};