巴比伦.js自定义场景无法加载

Babylon.js custom scene doesn't load

本文关键字:加载 js 自定义 巴比伦      更新时间:2023-09-26

我用这篇文章 http://blogs.msdn.com/b/eternalcoding/archive/2013/06/28/babylon-js-how-to-load-a-babylon-file-produced-with-blender.aspx 加载了一个巴比伦文件。

if (BABYLON.Engine.isSupported()) {
    var canvas = document.getElementById("renderCanvas");
    var engine = new BABYLON.Engine(canvas, true);
    BABYLON.SceneLoader.Load("", "scene.babylon", engine, function (newScene) {
        newScene.executeWhenReady(function () {
            // Attach camera to canvas inputs
            newScene.activeCamera.attachControl(canvas);
            // Once the scene is loaded, just register a render loop to render it
            engine.runRenderLoop(function () {
                newScene.render();
            });
        });
    }, function (progress) {
        // To do: give progress feedback to user
    });
}

最初它不起作用,但后来我在 web 配置文件中定义了 mimeMap,它开始工作

<mimeMap fileExtension=".babylon" mimeType="application/babylon" />
<mimeMap fileExtension=".babylonmeshdata" mimeType="application/babylonmeshdata" />

问题是当我把 scene.babylon 换到我的头上.babylon,它不起作用。Firefox 上没有任何加载,我在 IE 上收到此错误:

0x800a138f - JavaScript 运行时错误:无法获取未定义或空引用的属性"0"

我确实在 http://www.babylonjs.com/sandbox/上尝试了head.babylon,它加载得很好。关于我下一步可以做什么有什么建议吗?

我将我的 Ballylon.js 文件更新为最新版本,它刚刚奏效。我应该早点尝试。谢谢大家!