你好,我有我的項目的問題。我試圖加載我的巴比倫文件,但文件無法加載。它只顯示加載場景。 這裏是我的代碼如何加載file.babylon?它只顯示加載場景
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文件。 THX