Kanosaki
Kanosaki

Reputation: 92

Is there a way to unload a loaded model?

I would like to use a single viewer to load/unload models instead of tearing down the viewer and creating a new instance of viewer.

Reasoning: I've loaded multiple models and one of the models is too large and problematic that it slows down the rendering, I'm thinking if it's possible to just unload the problematic model instead of reloading all the models EXCEPT the problematic model.

Upvotes: 1

Views: 1252

Answers (1)

Eason Kang
Eason Kang

Reputation: 7070

If you just want to unload a specific model, the following code snippet might help.

const models = viewer.impl.modelQueue().getModels();
const model = models[2]; //!<< The model you want to unload
viewer.impl.unloadModel( model );

Upvotes: 3

Related Questions