Jump to content

Beginner questions (load a file)


AllForum
 Share

Recommended Posts

Hello,

I don't know html nor javascript but I would like to test webgl...
I am trying because it seems easy : create a .babylon file containing a camera, a light and a cube and draw it using babylon.js.
But nothing works... :wacko:
I don't know if it is due to the file or to the code to load or...

Here are my questions :

1- To be sure : I can test locally, without web server, by opening a local html file in my web browser and using a .babylon file on my local disk, isn't it ?
2- I don't know if the load does not work due to the file or to my Sceneloader use.
   Where can I find a valid .babylon file ? If possible the simplest one with a camera, a light and a cube mesh.
(to explain why a such question, before posting this question :
a- I read this forum and found 2 git sites with .babylon files. But for me the sandbox seems not reliable : loads stop during loading and have to be restarted several times, when something is drawn sometimes the number of vertices is 0, etc.
b- I don't know what is correct : I found in .babylon files the "activeCameraID" keyword but it is not in the babylon file format description. Is the documentation up to date ?
c- I tried to load in the sandbox the sample of the documentation but it does not draw (https://github.com/BabylonJS/Babylon.js/wiki/Babylon.js-file-format)
)

I think that the problem is in these 2 questions because I use the SceneLoader code I found in your posts.

 

Thanks in advance for your answer.

Link to comment
Share on other sites

Hi, 

 

Welcome in the wonderful Babylon world :)

 

To keep up with the first answer : 

1. You need a webserver if you want to load external files, like a babylon file, a texture, ... If you use only babylon primitives (box, sphere, ...), you don't need it.

2. As Dad said, You can find babylon files here https://github.com/BabylonJS/Samples. Be careful, a babylon file does not contains any texture. Be sure to have the texture in the same folder as your babylon file if you want to load one.

 

If you want to try, here is a babylon file : http://pixelcodr.com/tutos/toad_attack/babylon/toad.zip, and here is the code to load it : 

// The function ImportMesh will import our custom model in the scene given in parameterBABYLON.SceneLoader.ImportMesh("red_toad", "assets/", "toad.babylon", scene, function (meshes) {    var m = meshes[0];    m.scaling = new BABYLON.Vector3(0.5,0.5,0.5);});

Good luck :)

 

Cheers ,

Link to comment
Share on other sites

Thanks for your answers.

As I tried without webserver it may explain why nothing works...

With your toad.babylon file I think that I have understood why some files are not drawn in the sandbox : they probably only contain geometry without lights and cameras.

Thanks for your help

Link to comment
Share on other sites

I can load a mesh file or a full scene file. :)

 

If a full beginner like me read this post :

- It is plug&play to install iis on windows 7 : http://technet.microsoft.com/fr-fr/library/cc731179.aspx

- To be able to load a file these lines have to be added to the web.config file : http://www.html5gamedevs.com/topic/6737-cant-get-babylon-files-to-load/

 

I can play with Babylon now !

Thanks.

 

PS:

For information, only with firefox (nothing with seamonkey or IE), all seems to work well but I have a message in the web console :

- when I load your mesh file :

"BJS - [16:59:23]: Valid manifest file not found. Scene & textures will be loaded directly from the web server." babylon.1.12.js:3

- when I load a full scene :

InvalidStateError babylon.1.12.js:9

Link to comment
Share on other sites

Hey there, 

 

Congratulations ! I'm sure you will love to play with Babylon :)

 

For your information : 

 

 Valid manifest file not found.

 

Each mesh can be linked to a manifest file (as explained here : https://github.com/BabylonJS/Babylon.js/wiki/Caching-the-resources-in-IndexedDB) in order to cache all resources in the client browser. With this, your scene can play offline. You don't have to do it though, and babylon will retrieve all assets from the webserver (Scene & textures will be loaded directly from the web server.)

 

Cheers, 

Link to comment
Share on other sites

  • 1 year later...

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