【问题标题】:Animated mesh does not load in Babylon.jsBabylon.js 中不加载动画网格
【发布时间】:2015-02-08 06:02:41
【问题描述】:

我在 Blender 中创建了一个网格并将其命名为“Walking.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

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

【问题讨论】:

    标签: javascript animation


    【解决方案1】:

    打开记事本并输入:

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

    然后重命名:Walking.babylon.manifest 并将其放在“Walking.babylon”所在的位置。

    【讨论】:

      猜你喜欢
      • 2014-07-12
      • 1970-01-01
      • 1970-01-01
      • 2012-10-08
      • 1970-01-01
      • 2015-11-03
      • 2015-01-08
      • 1970-01-01
      • 2018-07-12
      相关资源
      最近更新 更多