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

I had to read this maybe a dozen times before understanding the question. I think the confusion is caused by the fact that transformNode was introduced later. See below.

I didn’t suggest using Load or Append. They will not return information about the asset. These functions are intended to load into a new/existing scene.

I’ll admit that when I first looked at the Babylon naming/structure, it was not what I expected. I wouldn’t call it convoluted though. A mesh in Babylon derives from a transformNode which derives from node. transformNode was added later and didn’t exist originally. You are correct in that the list of meshes does not include non-meshes (i.e., transformNodes, lights, cameras, etc). 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.

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?

Here is a working version: 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.

I’ll let @RaananW answer this one. :slight_smile:

I agree it can be simpler to use for some scenarios. As I said earlier, I have wanted to investigate making changes to the API, but we have to maintain backwards compatibility. Contributes welcome if you want to help.