Jump to content

Create .babylon file from javascript


TestyRabbit
 Share

Recommended Posts

Hey guys! So first off, Babylon.js is awesome. I've used THREE.js before and I recently switched to babylon for a project I'm doing and I love it.

First, I made my scene in Unity and used their exporter which worked great at first, but I noticed that the exporter bakes in lighting and that's not the effect I'm going for. I've decided then to try and make a scene just with pure javascript because it isn't a very complicated scene. However, I'm a big fan of the loading screen/feedback that is recieved when using the BABYLON.SceneLoader and I wanted to know if there was an easy way to take a scene I made in javascript and convert it to a .babylon file so I could use the SceneLoader?

Thanks!

-TestyRabbit

Link to comment
Share on other sites

Hi and welcome to the forum. The answer is yes and I did it a couple of years ago so some bits are a bit hazy but here goes. The following github has two functions  the first write the .babylon gile as text to a new page, the second downloads the fole to your computer.

https://github.com/Cubees/Cubees.github.io/blob/master/factory/shared/exporter.js

To see it working in context go to

http://cubees.github.io

And choose extrude or lathe.

To do a whole scene read about serialize

https://doc.babylonjs.com/classes/2.5/sceneserializer

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