Skip to content

RenderComponent - ability to dynamically add/remove MeshInstance. #6680

@Maksims

Description

@Maksims

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions