javascript - 动画网格无法在 Babylon.js 中加载

标签 javascript animation

我在 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 时,我在控制台中收到此消息:无法加载资源:服务器响应状态为 404(未找到),旁边是此链接:http://localhost:50207/Scenes/Models/Animation/Walking.babylon.manifest?1419869394361

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

最佳答案

打开记事本并输入:

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

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

关于javascript - 动画网格无法在 Babylon.js 中加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27692443/

相关文章:

javascript - Bootstrap 多选下拉菜单不可见

javascript - 在 JCarousel 中获取当前项目的索引

javascript - 模块路由在 Express 中不起作用

css - 如何使 `react-beautiful-dnd` 不触发 `react-transition-group` 动画?

objective-c - 如何使用 Objective C 淡入淡出动画隐藏/显示窗口

javascript - 如何有条件地渲染 Angular 组件

javascript - 使用 jQuery 访问各种元素

jquery - 改变位置的一个div内容

德尔福, Canvas : Complicated background animation under [blinding] image

objective-c - iCarousel 禁用在后台完成的任何其他动画