Jump to content

BabylonJS Lego building app


SvenFrankson
 Share

Recommended Posts

Hi,

You may try here my attempt with BabylonJS, a Lego building app.

mainScreenshot.PNG

It's not mobile compatible, as it requires a mouse cursor to preview bricks. It's on the roadmap !

Full project is available here : https://github.com/SvenFrankson/babylon-demo

A questions for the helpful BabylonJS veterans :

Is there an "easy way" to collect VertexData from Blender models ? I could not find any, so I wrote a JSON Unity exporter (sources here), but I guess I'm not the first one looking for this kind of behaviour in a BabylonJS app...

Thanks in advance ! Have a nice day,

Sven Frankson

Link to comment
Share on other sites

Hi Nockawa,

Most bricks are generated with the methods from this script : https://github.com/SvenFrankson/babylon-demo/blob/master/scripts/Meshes.ts

Given a size (length, width, height), CubicalData and SlideData generate the vertices to return the appropriate VertexData structure, which is then applied to the mesh.

The other bricks (flames, corners, barrels) were made using Blender.

Have a nice day !

Link to comment
Share on other sites

3 hours ago, Nockawa said:

Take a look at this, I have a whole project that read/convert ldraw parts to BJS's mesh in order to render LDraw models in babylon. If you need the code, I'll be happy to share it.

Nice, I did not know there was some "Lego Standard" for this kind of project...

As mine is just a practice demo with BabylonJS, I'm not sure I'll go through the troubles of LDraw-interoperability. Keeping with the simple json strings to store the bricks should be enough. Thanks !

Link to comment
Share on other sites

1 minute ago, SvenFrankson said:

Nice, I did not know there was some "Lego Standard" for this kind of project...

As mine is just some practice demo with BabylonJS, I'm not sure I'll go through the troubles of LDraw-interoperability. Just keeping with the simple json strings to store the bricks should be enough. Thanks !

It's not about interop, it's about if you want all the Lego parts (there's hundred of them) that exists to display them, it's the best way to do so. Now you can do it yourself, but converting a ldraw file of a given part to a json file containing everything to create the mesh is something I already did, so if you change your mind, I'll share the source code.

What you've done is great, the way to pile up the part is great, but just for your info, there's already "officials" parts, colors, decals that exists.

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