瀏覽代碼

Bug fix - when the gamepad is disconnected

When the actual gamepad is disconnected, the gamepad object will still
exist. Now the leftStick value is being tested, which ensures that the
values are provided.
checking for browserGamepad might also be valid, but the browser might
leave the object as well.
Raanan Weber 8 年之前
父節點
當前提交
27d3357612
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/Cameras/Inputs/babylon.freecamera.input.gamepad.ts

+ 1 - 1
src/Cameras/Inputs/babylon.freecamera.input.gamepad.ts

@@ -29,7 +29,7 @@ module BABYLON {
         }
 
         checkInputs() {
-            if (this.gamepad) {
+            if (this.gamepad && this.gamepad.leftStick) {
                 var camera = this.camera;
                 var LSValues = this.gamepad.leftStick;
                 var normalizedLX = LSValues.x / this.gamepadMoveSensibility;