Importing custom made shapes to a ground in a scene

I am wondering how I could import custom made shapes or objects into a scene and have them placed on the ground of the scene. I want to be able to use these shapes just like any other mesh in babylon (like the sphere, box, etc.)

Its just a matter of positioning your import. Could you be more specific about the problem you are having. A repro would be useful as well

My application is too big to create a playground example, but lets say I have a normal ground with a sphere on it like the default babylon.js playground example , and I have a designer that is creating customized shapes or lets say objects for me to place on the ground, how would I be able to import these shapes created externally by my designer, into the scene on the ground, along with the sphere? In my application, I am able to add new shapes by the click of a button, and these shapes can be dragged around the ground and edited and much more. I just want to be able to import shapes or objects of my own and to work with them the same way I do with normal babylon shapes like spheres and boxes…

You are going to need to use the SceneLoader class and load the objects in with one of its few
different methods for doing so. It’s going to take some research to get going with at first.

I think as far as format you want from your artist, you should also read the documentation around GLTF. That’s going to make your life easiest in the long run.

Alright I see, but I even tried to download a model so that I could import it locally from an assets folder, but I keep getting this error “Unable to import meshes from ./assets/ripe-banana.obj: Error status: 431 Request Header Fields Too Large - Unable to load ./assets/ripe-banana.obj”, and the object doesn’t end up showing at all. Do you have any idea why or how I could fix this?

The simpler option is to just host them yourself somewhere online.

If you really want to work locally, you have to have some kind of local web server running. Personally, I think the simplest option is serve - npm It will mean installing NodeJS first but you are going to have some setup to do no matter what you choose.

After that, serve is one line in the terminal to host any folder locally. ( read their instructions ) You would be able to use http://localhost:8000/assets/ripe-banana.obj as the url for it once setup

1 Like

@br-matt Thank you so much! No I don’t really want to work locally because I want the app to be deployed later on and I want it to be easier for the shapes to be imported.