Using ModelInstanceCollection

While trying to add a couple of hundred copies of a model to cesium I stumbled across ModelInstanceCollection in the source code. I managed to get it to do part of what I wanted, but I’m slightly worried about the fact this method appears to be completely undocumented. Is this purely an internal method that shouldn’t be used directly or has it just not been documented? Also it I want to animate or update the positions of each model instances independently (possibly by updating each instance’s Transformation Matrix) is using a ModelInstanceCollection the best approach?

Dag

It is a private class which means it is subject to changes in the API, but this does sound like exactly what it was made for. I think the only reason it’s still private is just that we haven’t gotten around to exposing it yet. I opened an issue to expose it here:

https://github.com/AnalyticalGraphicsInc/cesium/issues/7062

Feel free to contribute ideas/feature requests or any bugs you encounter while using it directly!

Internally it’s used for 3D Tiles to support a lot of instances of the same model. You can see how it’s used here:

https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/Instanced3DModel3DTileContent.js#L419

To update them I believe you would have to update each instance’s model matrix.

So far I have 150 cars all moving around att the same time based on the results of a vissim simulation without a hiccup, so that part seems to work. Applying a rotation is doing weird things, but that may still be on me.

Dag

If you do suspect it’s a bug/unexpected behavior, if you can put together a Sandcastle example of it and share it, that would help us a lot.

Hi Omar,

I need to add more than one of the same model in different locations. But I think the model instance feature has been removed. Even though it’s the same url, I’m having trouble rendering it. What path should I follow? Is ModelInstanceCollection still used? What is the alternative?

Hi there,

That class has been removed, but we are considering adding it back to the API.

I’ll bump that thread with this request.

Thanks!