浏览代码

Use the first VR position sensor we see.

This fixes things for Firefox since the latest builds include both an
Oculus device and a Cardboard device, even if you're on a desktop PC.
Brian Peiris 10 年之前
父节点
当前提交
329082c70d
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      examples/js/controls/VRControls.js

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

@@ -19,13 +19,15 @@ THREE.VRControls = function ( object, onError ) {
 
 				vrInputs.push( devices[ i ] );
 
+				break; // We keep the first we encounter
+
 			}
 
 		}
 
 		if ( onError ) onError( 'HMD not available' );
 
-	};
+	}
 
 	if ( navigator.getVRDevices ) {
 
@@ -41,7 +43,7 @@ THREE.VRControls = function ( object, onError ) {
 
 	this.update = function () {
 
-		for ( var i = 0; i < vrInputs.length; i++ ) {
+		for ( var i = 0; i < vrInputs.length; i ++ ) {
 
 			var vrInput = vrInputs[ i ];
 
@@ -65,7 +67,7 @@ THREE.VRControls = function ( object, onError ) {
 
 	this.resetSensor = function () {
 
-		for ( var i = 0; i < vrInputs.length; i++ ) {
+		for ( var i = 0; i < vrInputs.length; i ++ ) {
 
 			var vrInput = vrInputs[ i ];