Babylon.js - e.Gamepads不是构造函数

时间:2016-11-16 08:29:54

标签: javascript babylonjs gamepad

跟随巴比伦教程,它可能是它使用旧版本的BabylonJS - 但我收到错误:

 e.Gamepads is not a constructor

使用以下代码

var bApp = bApp || {};

bApp.init = function(){
//get the canvas
 var canvas = document.getElementById('renderCanvas');

 //create a BabylonJS engine object, true for antialias
 var engine = new BABYLON.Engine(canvas, true);

//create a scene
var scene = new BABYLON.Scene(engine);

//create a camera
var camera = new BABYLON.ArcRotateCamera('camera', 0, 0, 15,        BABYLON.Vector3.Zero(), scene);

//let the user move the camera
camera.attachControl(canvas);

//light
var light = new BABYLON.HemisphericLight('light1', new BABYLON.Vector3(0,1,0), scene);

var sun = BABYLON.Mesh.CreateSphere('sun', 16, 4, scene);

engine.runRenderLoop(function () {
 scene.render();
});

 // the canvas/window resize event handler
 window.addEventListener('resize', function(){
   engine.resize();
 });

}

window.addEventListener('DOMContentLoaded', function(){
  bApp.init();
 });

该教程似乎是旧版本的Babylon(2.1),我试图使用2.4。

0 个答案:

没有答案