How does scene organization compare to Unity / Unreal / Godot?

Hello everyone,

can you help me seeing the “big picture” in how to organize scenes in BabylonJS out of the box?

I tried to create a complete hierarchy of visual and non-visual nodes, and noticed that:

  • The Node class has neither setParent nor addChildren methods
  • The TransformNode class only has a setParent method
  • AbstractMesh has both setParent and addChildren methods

Did I miss something here or am I correct to assume that “children” are only available for means of visual child meshes, not for setting up general hierarchies?

Generally asking, is there something like a “global” hierarchy of nodes available in BabylonJS which also covers non-visual / virtual nodes, like Godot? Or something similar to the “Entity” part of the ECS found in Unity or comparable to Unreal?

The question is not about favoring one or the other. I’m simply trying to “port”, in a sense, an ancient game (engine) over to the web for fun which does have a hierarchy, and currently check how much I can utilize BabylonJS features for it, and how much I would implement myself.

I think that in the early days there was one way to form a hierarchy, that was using the parent property. At various times community members wanted to add setParent and addChild to some objects but did not necessarily add them to all objects with parent property. Also at some point some properties were re-coded as accessors.

Often a ‘non-visual’ parent was formed from an empty mesh and then later a transformNode was added as a lighter way of having a ‘non-visual’ parent.

You can see which objects just have properties and accessors for parent/child relationships and which have added methods to form parent/child relationships by checking out the API, for example

Hope that helps.

3 Likes

Thanks for your reply. I guess I somehow missed the “basic” parent property and was a bit confused since I thought I couldn’t parent or child Node instances to anything.
It’s good to know why the exposed methods differ a little bit. I’ll try to port the old game’s would-be “nodes” in some way to fit nicely into Babylon’s hierarchy, that would be much less hazzle then trying to implement a custom hierarchy on top of it.