Jump to content

Animated mesh does not load in Babylon.js


mangualmanuel
 Share

Recommended Posts

I created a mesh in Blender and called it "Walking.babylon". I set it up in my code like so:

///<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 scenevar 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);// Groundvar 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;// Shadowsvar shadowGenerator = new BABYLON.ShadowGenerator(1024, light);// DudeBABYLON.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 itengine.runRenderLoop(function () {scene.render();});//Resize window.addEventListener("resize", function () {engine.resize();});}}

But When I load my scene and hit F12 I get this message in the console: Failed to load resource: the server responded with a status of 404 (Not Found) and right next to it is this link: http://localhost:50207/Scenes/Models/Animation/Walking.babylon.manifest?1419869394361

So my question is: what am I doing wrong that is causing my animated mesh not to show?

post-12241-0-52176800-1419870853_thumb.p

Link to comment
Share on other sites

Hello,

 

you should configure IIS with a web.config like this:

```

<?xml version="1.0"?>
 
<!--
  For more information on how to configure your ASP.NET application, please visit
  -->
 
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
  <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".json" mimeType="application/text" />
      <mimeMap fileExtension=".dds" mimeType="application/dds" />
      <mimeMap fileExtension=".tga" mimeType="application/tga" />
      <mimeMap fileExtension=".fx" mimeType="application/fx" />
      <mimeMap fileExtension=".babylon" mimeType="application/babylon" />
      <mimeMap fileExtension=".babylonmeshdata" mimeType="application/babylonmeshdata" />
      <mimeMap fileExtension=".babylonbinarymeshdata" mimeType="application/babylonbinarymeshdata" />
      <mimeMap fileExtension=".cache" mimeType="text/cache-manifest" />
      <!--<mimeMap fileExtension=".mp3" mimeType="audio/mpeg" />-->
      <!--<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
      <mimeMap fileExtension=".mp4" mimeType="video/mp4" />-->
    </staticContent>
   
  </system.webServer>
</configuration>
```
Link to comment
Share on other sites

The problem with using the sandbox as debugging tool in this case is the camera and lights are not defined in the .babylon file.  This development approach does have a little trickier debug, since you cannot just hit F12 in Blender to render and spot obvious things like the camera or lights are not pointed right.

 

Also the 404 is on the optional manifest file, ignore that.

 

First key question is:  Do you get a Black window, meaning a lighting / aiming issue.  Or white window, meaning a Java script error has occurred.

Link to comment
Share on other sites

Hello, 

 

I can see in yoru code that you are trying to create a shadow generator with an Hemispheric Light => you should have a javascript error with this.

Try to replace your hemispheric light with a directional light (cf wiki https://github.com/BabylonJS/Babylon.js/wiki/15-Shadows), and everything will be ok :)

 

If it is not, can you please provide an URL where we can debug in real time ?

 

Cheers !

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...