# Loading .babylon scene as a child of a specific scene graph node

**URL:** <https://forum.babylonjs.com/t/loading-babylon-scene-as-a-child-of-a-specific-scene-graph-node/42328>\
**Category:** Questions\
**Tags:** node, load, import, scene\
**Created:** [July 11, 2023, 7:58pm UTC](https://forum.babylonjs.com/t/loading-babylon-scene-as-a-child-of-a-specific-scene-graph-node/42328 "2023-07-11T19:58:50Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![trusktr](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/trusktr/32/840_2.png) [@trusktr](https://forum.babylonjs.com/u/trusktr)\
**Post date:** [July 28, 2023, 8:15pm UTC](https://forum.babylonjs.com/t/loading-babylon-scene-as-a-child-of-a-specific-scene-graph-node/42328/16 "2023-07-28T20:15:27Z")

</div>

> [@bghgary](#):
>
> For glTF, the top-level root node is always the first mesh in the meshes array, which is actually an empty mesh (i.e., a mesh with no geometry) and not a transformNode due to backwards compatibility. This can be used to traverse the entire tree.

Thanks for explaining!

It would be great for that explanation to be in the API docs. That is completely not intuitive from the naming, and the type definitions. I would never assume (especially for a particular file type) that the root node is an empty mesh, and that it is specifically the first one in a list of meshes.

I get that maybe that’s there for backwards compatibility, but why wasn’t a better intuitive API added as an alternative, and possibly the old stuff deprecated? Keeping backwards compatibility is only part of the ideal picture. We need new features with new APIs that make sense, without backwards compat causing APIs to be very unintuitive.

I’m also not using exclusively GLTF, so what’s the answer for all other assets types?

Adding `.rootNodes` to `ImportMeshes` would _seem_ to be intuitive: we’d know exactly where to get the root node(s) we from our imported model, but:

> [@bghgary](#):
>
> I’m not sure who added `rootNodes` but it’s not populated by the loaders and is always empty unless `instantiateModelsToScene` is called. @RaananW/@carolhmj Can you take a look?

Well that makes no sense! So now there’s an API that gives me a result with `rootNodes`, but they aren’t the root node(s) of the thing I imported? 🥴

The answer is still not clear (especially for non-GLTF models).

I’m hoping intuitive APIs can replace these old ones.

> [@bghgary](#):
>
> Here is a working version: [https://playground.babylonjs.com/#8FHM4P#4](https://playground.babylonjs.com/#8FHM4P#4). I would expect `rootNodes` to work, but it isn’t currently populated. `addAllToScene` or equivalent needs to be called in order for the scene to know about the nodes.

But same problem: that only works based on an undocumented quirk mentioned in this thread specifically for GLTF files.

How do we get the root node(s) of _any type of model_ we import, without making a new scene, without adding the model to an existing scene? And then how do we [properly create a parent node in a scene](https://forum.babylonjs.com/t/why-does-transformnode-constructor-have-scene-and-ispure-parameters/42767/12), and then properly parent the loaded model into that parent node?

---

_[View the full topic](https://forum.babylonjs.com/t/loading-babylon-scene-as-a-child-of-a-specific-scene-graph-node/42328)._
