Why is the entity’s model root graphNode is located in
this.entity.model.model.graph
and not
this.entity.model.graph
Would like the rationale of this…
Why is the entity’s model root graphNode is located in
this.entity.model.model.graph
and not
this.entity.model.graph
Would like the rationale of this…
this.entity.model is the model component the ‘raw’ data about the model is stored in the object variable model of the component. It is not the best naming scheme but its a bit difficult to change it now.
This is a characteristic of the engine I’m not too happy with. To be honest, the graph of a model should just be child entities of the entity with the model component.
The original rationale was that the engine has three layers:
You were supposed to be able to use just layer 1, or layer 1 + layer 2, or layer 1 + layer 2 + layer 3.
These days, the separation is way less important, because, to be honest, you’d be crazy not to use all 3 layers. But the split is still quite nice for keeping the engine modular. You can see these layers in the GitHub repo:
But since pc.Model and pc.ModelComponent exist in different layers, there’s need to do this.entity.model.model.graph.
We could just make a property on the model component that allows you to do this.entity.model.graph. We did that for the meshInstances property. However, I suspect that we’ll probably going to do the following in the next year:
By that do you mean presenting the model’s MeshInstances in the Editor hierarchy?
I mean, displaying the model hierarchy as entities in the Hierarchy panel. Entities that have meshInstances attached will have maybe a new component type called something like pc.MeshComponent, which will have an array of pc.MeshInstances.