I’ve downloaded free objects from websites and import them into Blender. Everything looks normal.
I have installed a BabylonJS plugin for exporting 3D objects to my_object.babylon files. Looks normal.
I then load the babylon file in my Babylon scene, where it shows up. Looks normal.
But this is where I start to struggle.
I build code like:
async importCarMesh(){
const importPromise = await SceneLoader.ImportMeshAsync(
"", // root url
"assets/blender/startercar_v1_2.babylon", // file name
"", // scene name
this.scene // the scene where the model will be added
);
return importPromise.meshes[0];
}
Here I already don’t really know what I’m doing, I’m just picking meshes[0] because this worked for some 3D models, but not for all. Why do I have an array of Meshes?
I basically just want “the” object after the import and do things with it. I don’t know why it’s divided in a meshes array.
Why does it work for one object, but another object goes like “nope, we’re not doing that today”
For some 3D models, just grabbing meshes[0] works fine enough and I can have the object move around. But for other 3D models, it’s only the tyres of the car, or the body. And there is no “whole object” I can find in the meshes array.
I’m not asking for a particular solution for a particular problem.
But here are my questions instead:
- Why is it all made so confusing and seemingly random? Why does the one babylon object exported from Blender behave so differently compared to another one?
- Is there some tool that I’m missing? Is there a way I can view my .babylon files more properly, with some tree or something that shows like "here are your meshes, and the entire object as a whole can be called just by this particular variable.
- I just can’t imagine that you professional devs, go loop through a meshes array to figure out what “the” one mesh is that is the entire car instead of just its wheels or sidepods. I must be missing something…
It’s a very steep learning curve and the behaviors of the object all seems so random.
I’ll give another example:
A mesh has a “lookAt” variable. That sounds intuitive, I make it “look at” vector3(50,0,50) for example. And instead of the car just rotating to that Vector, it suddenly is standing tilted on its side in an awkward position. It’s things like this that make me go like “how even does any of this work”, you understand my confusion?