您好,我的项目有问题。我尝试加载我的巴比伦文件,但文件无法加载。它只显示加载场景。这是我的代码
var canvas, engine, scene, camera, score = 0;
document.addEventListener("DOMContentLoaded", function () {
onload();
}, false);
window.addEventListener("resize", function () {
if (engine) {
engine.resize();
}
},false);
var onload = function () {
// Engine creation
canvas = document.getElementById("renderCanvas");
engine = new BABYLON.Engine(canvas, true);
scene = new BABYLON.Scene(engine);
initGame();
initScene();
engine.runRenderLoop(function () {
scene.render();
});
};
function initScene() {
// Create the camera
camera = new BABYLON.FreeCamera("camera", new BABYLON.Vector3(0,4,-10), scene);
camera.setTarget(new BABYLON.Vector3(0,0,10));
camera.attachControl(canvas);
// Create light
var light = new BABYLON.PointLight("light", new BABYLON.Vector3(0,5,-5), scene);
engine.runRenderLoop(function () {
scene.render();
});
}
function initGame() {
//BABYLON.Mesh.CreateSphere("sphere", 10, 1, scene);
BABYLON.SceneLoader.Load("/assets/", "harimau.babylon", engine, function (newScene) {
// ...
});
}
这是我的代码,我不知道如何加载我的harimau.babylon 文件。谢谢