你好,我有我的项目的问题。我试图加载我的巴比伦文件,但文件无法加载。它只显示加载场景。 这里是我的代码如何加载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