动画网格不会加载到Babylon.js中

时间:2014-12-29 16:26:01

标签: javascript animation

我在Blender中创建了一个网格并称之为#34; Walking.babylon"。我在我的代码中设置了它在babylon教程中的说明:

///<reference path="/ref script/babylon.1.14-debug.js"/>

"use strict"

var canvas;
var engine;
var scene;

document.addEventListener("DOMContentLoaded", startBabylonJS, false);

function startBabylonJS() {
    if (BABYLON.Engine.isSupported()) {
        canvas = document.getElementById("renderCanvas");
        engine = new BABYLON.Engine(canvas, true);
        scene = new BABYLON.Scene(engine);

        var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene);
        light.position = new BABYLON.Vector3(20, 150, 70);

        //create the camera that will view our scene
        var cam = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 5, -10), scene);
        cam.setTarget(new BABYLON.Vector3.Zero());
        cam.attachControl(canvas, false);

        scene.ambientColor = new BABYLON.Color3(0.3, 0.3, 0.3);

        // Ground
        var ground = BABYLON.Mesh.CreateGround("ground", 1000, 1000, 1, scene, false);
        var groundMaterial = new BABYLON.StandardMaterial("ground", scene);
        groundMaterial.diffuseColor = new BABYLON.Color3(0.2, 0.2, 0.2);
        groundMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
        ground.material = groundMaterial;
        ground.receiveShadows = true;

        // Shadows
        var shadowGenerator = new BABYLON.ShadowGenerator(1024, light);

        // Dude
        BABYLON.SceneLoader.ImportMesh("man", "Scenes/Models/Animation/", "Walking.babylon", scene, function (newMeshes, particleSystems, skeletons) {
            var dude = newMeshes[0];

            for (var index = 0; index < newMeshes.length; index++) {
                shadowGenerator.getShadowMap().renderList.push(newMeshes[index]);
            }

            dude.rotation.y = Math.PI;
            dude.position = new BABYLON.Vector3(0, 0, -80);

            scene.beginAnimation(skeletons[0], 0, 100, true, 1.0);
        });

        //Once the scene is loaded, just register a render loop to render it
        engine.runRenderLoop(function () {
            scene.render();
        });

        //Resize 
        window.addEventListener("resize", function () {
            engine.resize();
        });
    }
}

但是当我加载我的场景并点击F12时,我在控制台中收到此消息:Failed to load resource: the server responded with a status of 404 (Not Found),紧挨着它就是这个链接:http://localhost:50207/Scenes/Models/Animation/Walking.babylon.manifest?1419869394361

所以我的问题是:我做错了什么导致我的动画网格无法显示?

1 个答案:

答案 0 :(得分:1)

打开记事本并将其放入:

{
  "version" : 1,
  "enableSceneOffline" : true,
  "enableTexturesOffline" : true
}

然后重命名:Walking.babylon.manifest 把它放在“Walking.babylon”的地方。