Merge models meshInstances

Good evening guys.

Is there any way to merge two models into one? I need to get the meshInstances from one model and put into another one.

if anyone could at least show me how to deal with mesh instances (add, clone and delete) of a model will be very helpful.

1 Like

Hey @derickwelman,

There aren’t any methods to do that directly in the mesh instance class, so normally you would have to rebuilt the merged model yourself (vertices, indexes, materials, normals etc).

But that can be quite advanced.

There is an alternative way in doing this, using the pc.Batcher class, which is responsible for creating the static and dynamic batches. Each batch is essentially a single meshInstance which has been created to combine all mesh instances contained in a batch bounding box.

It’s a bit tricky to use it initially since there are no examples, but you can study how Playcanvas automatically uses it to enable batching when your app launches. From there you can understand how to start using the same methods to achieve your goal.

The methods that you are mostly interested are:

  • addGroup
  • prepare
  • create

An instance of the batcher is available here:;

Here is where the batches are created:


Thanks Leonidas, i’ll take a look into these links

1 Like