2
0
Эх сурвалжийг харах

ViveController: Exposed gamepad.

Mr.doob 9 жил өмнө
parent
commit
28cecf607d

+ 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 ) {