Asset Container via Asset Manager

Hey,

I am trying to use Asset Container via Asset Manager. And implemented it based on my understanding and it works but I wan to make sure some points and my implementation is on the right track.

  1. Container creation
    var model = assetsManager.addContainerTask(…);
    Question - I have 4 models to load so I have to repeat addContainerTask for each models. does that mean adding those models in a single container or is it creating a new container for each model?

  2. Model Reflection
    I have a common function that creates a reflection for all models on a common ground. And the issue here is, even though the models are not added to the scene, the reflection is visible on the ground. So to handle this issue, I create the reflection every time when the model is added to the scene.
    Questions - is it the right approach?
    Prior the asset container implementation, we use model.setEnable(true | false) to determine to display or not the model in the scene. This works with the logic to create a reflection for all models at once and we get a reflection only for those visible models only.

  3. If there is a playgound link that demonstrate use of asset container via asset manager that include reflection logic with switching from model to model (adding and removing model to scene).

  4. is there a feature to check container related stuff on the inspector?

Thanks in advance.

Hey!

  1. it will create 4 containers
  2. It is the right approach :slight_smile:
  3. Nope this is kind of too precise ;D
  4. No you don’t see them in the inspector
1 Like

@Deltakosh Thanks for your precise answers.

One more question, what if I use BABAYLON.SceneLoader.LoadAssetContainer(…) (like - BlendWebMix | Babylon.js Playground), is it going to be the same situation? is it going to create different containers for each model?

I m intending to put all the models in a single container. And I get the models from glb file. Any suggestion?
Here is how I need to use asset container - BlendWebMix | Babylon.js Playground

Correct (unless all the meshes are in the same file)

@Deltakosh thanks.

hey @Yofetahe_Habtu for your 3rd question I found a PG which may help you to use asset manager with container https://playground.babylonjs.com/#ZQPDEF#18

I think ContainerAssetTask from this Playground has it already made into BJS, see: ContainerAssetTask | Babylon.js Documentation. It just isn’t mentioned in the official Documentation: Asset Manager | Babylon.js Documentation

1 Like

Yes, you are right. here is a working example
Babylon.js Playground