when I create instances,The web occur a question ,Instances should only be created for meshes with geometry
Instances are used to draw a mesh multiple times in a single drawcall.
if your mesh doesn’t have any geometry there is no benefit to use instances
Sorry, have no time to explain in details, just a couple of examples - https://playground.babylonjs.com/#AJA5J6#80
and https://playground.babylonjs.com/#AJA5J6#77 with instantiateModelsToScene()
function (more about it in API).
(Note that the latest example not instances but clones the model because of doNotInstantiate: true
parameter).
In the first example I see you use result.meshes[1]
.
So the instances don’t rely on the __root__
node?
I’m creating meshes by instances and they completely lose the babylon space transformation.
They need to be parented to the same root if you want it to apply
Cool.
I had to do some adjustments to make it work:
- Detach the geometry from the parent
- Clone the parent
- Instantiate the geometry
- Set the cloned parent to that new instance
It worked perfectly