فهرست منبع

add component to register gamepad events

Trevor Baron 7 سال پیش
والد
کامیت
29631c778d
2فایلهای تغییر یافته به همراه6 افزوده شده و 0 حذف شده
  1. 1 0
      dist/preview release/what's new.md
  2. 5 0
      src/Gamepad/babylon.gamepadSceneComponent.ts

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

@@ -106,6 +106,7 @@
 - Avoid firing button events multiple times when calling vrController.attachMesh() ([TrevorDev](https://github.com/TrevorDev))
 - Parse geometry when load binary mesh ([SinhNQ](https://github.com/quocsinh))
 - Removing observers during observable notify should not skip over valid observers ([TrevorDev](https://github.com/TrevorDev))
+- Initializing gamepadManager should register the gamepad update events ([TrevorDev](https://github.com/TrevorDev))
 
 ### Core Engine
 

+ 5 - 0
src/Gamepad/babylon.gamepadSceneComponent.ts

@@ -14,6 +14,11 @@ module BABYLON {
         get: function (this:Scene) {
             if (!this._gamepadManager) {
                 this._gamepadManager = new GamepadManager(this);
+                let component = this._getComponent(SceneComponentConstants.NAME_GAMEPAD) as GamepadSystemSceneComponent;
+                if (!component) {
+                    component = new GamepadSystemSceneComponent(this);
+                    this._addComponent(component);
+                }
             }
 
             return this._gamepadManager;