Browse Source

ViveController: Exposed gamepad.

Mr.doob 9 years ago
parent
commit
28cecf607d
1 changed files with 4 additions and 1 deletions
  1. 4 1
      examples/js/ViveController.js

+ 4 - 1
examples/js/ViveController.js

@@ -2,6 +2,9 @@ THREE.ViveController = function ( id ) {
 
 	THREE.Object3D.call( this );
 
+	var gamepad;
+
+	this.getGamepad = function () { return gamepad; };
 	this.matrixAutoUpdate = false;
 	this.standingMatrix = new THREE.Matrix4();
 
@@ -11,7 +14,7 @@ THREE.ViveController = function ( id ) {
 
 		requestAnimationFrame( update );
 
-		var gamepad = navigator.getGamepads()[ id ];
+		gamepad = navigator.getGamepads()[ id ];
 
 		if ( gamepad !== undefined && gamepad.pose !== null ) {