瀏覽代碼

Add position tracking to VRControls

Peter Ehrlich 10 年之前
父節點
當前提交
5f6b04a584
共有 1 個文件被更改,包括 9 次插入3 次删除
  1. 9 3
      examples/js/controls/VRControls.js

+ 9 - 3
examples/js/controls/VRControls.js

@@ -44,11 +44,17 @@ THREE.VRControls = function ( object, callback ) {
 
 		if ( vrInput === undefined ) return;
 
-		var orientation = vrInput.getState().orientation;
+		var state = vrInput.getState();
 
-		if ( orientation !== null ) {
+		if ( state.orientation !== null ) {
 
-			object.quaternion.set( orientation.x, orientation.y, orientation.z, orientation.w );
+			object.quaternion.copy( state.orientation );
+
+		}
+
+		if ( state.position !== null ) {
+
+			object.position.copy( state.position );
 
 		}