When creating procedural meshes, sometimes it is beneficial to add them to a single render component. Currently, if you set a new array of mesh instances, previous ones will be destroyed - which is not always desirable. So adding mesh instances not in one go is not convenient atm.
I wrote a quick workaround for this:
// add MeshInstance to RenderComponent
const meshInstances = entity.render.meshInstances.slice(0);
entity.render._meshInstances = [];
meshInstances.push(this.meshInstance);
entity.render.meshInstances = meshInstances;
Of course this is not great, so it would be good to have a public API for it, something like:
entity.render.addMeshInstance(meshInstasnce);
entity.render.removeMeshInstance(meshInstance);
When creating procedural meshes, sometimes it is beneficial to add them to a single render component. Currently, if you set a new array of mesh instances, previous ones will be destroyed - which is not always desirable. So adding mesh instances not in one go is not convenient atm.
I wrote a quick workaround for this:
Of course this is not great, so it would be good to have a public API for it, something like: