浏览代码

Merge pull request #4923 from TrevorDev/handleControllersWithNoLeftStick

default left and right non null-able sticks to 0,0
sebavan 7 年之前
父节点
当前提交
64e0bf8a70
共有 2 个文件被更改,包括 3 次插入2 次删除
  1. 1 0
      dist/preview release/what's new.md
  2. 2 2
      src/Gamepad/babylon.gamepad.ts

+ 1 - 0
dist/preview release/what's new.md

@@ -157,6 +157,7 @@
 - GizmoManager should hide existing gizmos if a non-attachable mesh is selected ([TrevorDev](https://github.com/TrevorDev))
 - Ignore isPickable = false for vr ray casting if the mesh's name matches the specified floorMeshName to maintain backwards compatability ([TrevorDev](https://github.com/TrevorDev))
 - Fix File Loading if hosted from `file:`-Protocol ([ltetzlaff](https://github.com/ltetzlaff))
+- Do not throw error when updating a controller with no left stick ([TrevorDev](https://github.com/TrevorDev))
 - Exiting VR can result in messed up view ([TrevorDev](https://github.com/TrevorDev))
 
 ### Core Engine

+ 2 - 2
src/Gamepad/babylon.gamepad.ts

@@ -15,8 +15,8 @@
 
         public type: number;
 
-        private _leftStick: StickValues;
-        private _rightStick: StickValues;
+        private _leftStick: StickValues = { x: 0, y: 0 };
+        private _rightStick: StickValues = { x: 0, y: 0 };
 
         /** @hidden */
         public _isConnected = true;