Jump to content

Loading manifest, but not .babylon


Kevin192291
 Share

Recommended Posts

Hello, I have been trying to get a .babylon file to load, but just can't seem to get it to show up.

Here is an example of my code:

        var canvas = document.getElementById("renderCanvas");        var engine = new BABYLON.Engine(canvas, true);        var createScene = function () {            var scene = new BABYLON.Scene(engine);            var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(20, 20, 100), scene);            var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0.8, 100, BABYLON.Vector3.Zero(), scene);            camera.attachControl(canvas, false);            BABYLON.SceneLoader.ImportMesh("", "", "/webGL/textures/Link/Car.babylon", scene, function (newMeshes) {                camera.target = newMeshes[0];            });            // Move the light with the camera            scene.registerBeforeRender(function () {                light.position = camera.position;            });            return scene;        }        var scene = createScene();        engine.runRenderLoop(function () {            scene.render();        });        // Resize        window.addEventListener("resize", function () {            engine.resize();        });

The problem seems to be that the manifest loads as /Car.babylon.manifest?1424064684181200

but I don't see Car.babylon loading after. In the examples I see 2 objects loading in my console; the manifest, and the .babylon.

If you guys could give me some direction with this, I would really appreciate it.

Thanks :)

-Kevin

Link to comment
Share on other sites

this not correct signature: 
BABYLON.SceneLoader.ImportMesh("", "", "/webGL/textures/Link/Car.babylon", scene, function (newMeshes) {    camera.target = newMeshes[0];});

this correct: (signature: (name, path, file, scene ...)

BABYLON.SceneLoader.ImportMesh("", "./webGL/textures/Link/", "Car.babylon", scene, function (newMeshes) {    camera.target = newMeshes[0];});
Link to comment
Share on other sites

When you use function "ImportMesh", babylon first try to load your "manifest" file. If it doesn't exist, it'll load your "babylon" file. This is not a problem, but if you want that your files load from cache not from server directly, you need to create manifest file, like that :

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

and save as : Car.babylon.manifest.

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...