Exporting scene from editor

I have read that you can create a scene with editor adding models and textures and then export the complete scene and load it with babylon.js. What I’m trying to do is use Box2D.js as a serverside physics engine and, for convenience, I don’t really want to redo the map again after finishing it in the editor.

Im looking for a way that when I export the scene from the editor, and there is some data(from the .babylon file) I can use to generate the colliders using Box2D. Like, for example, an specific type of object with position, orientation and size and then using that data to create the boundaries and gets removed when the scene is loaded. Or any other idea.

@julien-moreau the editor mastermind can probably help here.

Hey @_Cri5! Sorry for the delay :slight_smile:

According to this post (Babylonjs Editor export without textures - Questions - Babylon.js) I just added the way to export .babylon scene files including ONLY geometries. So, using that export it can be easily loaded in server-side to compute some physics in server-side.

The only way I see (at the moment) to get custom properties in a .babylon file is to use the .metadata properties of objects (available on meshes, sounds, lights, cameras, etc.). Can you tell me kind of data you’de like to be custom data? Thanks :slight_smile:

@julien-moreau I was thinking something like having an object type named Collider or something. It could be cube shaped, spheres or whatever. So when you export the scene itself, it ignores those collider type objects, but with another option that is export ONLY the colliders objects data like position, rotation, scale, etc. It would be better if it could be exported as a JSON file and then when it is open in the node server, it could use the data to generate the colliders(again, using Box2D).

For example, there is a list of objects and each one has their position, rotation and scale(as a JSON) and then I use the data to generate the colliders(cubes). It could be very helpful.

@_Cri5, this looks to much specific to be integrated in the Editor itself. Anyway, the Editor provides a plugin system. I think we should start by developing a plugin to handle your specific case. What I can do is to create a simple plugin as an example. I’ll create a repository on github and build the basics of the plugin for you.

1 Like

@_Cri5 I just started implementation here: GitHub - julien-moreau/babylonjs-editor-box2d-plugin: Provides a basic implementation for specific box2d integration.
You can take a look at how the plugin looks like and how you could generate the JSON file you can use on server-side

1 Like