Import Mesh Async Camera Framing Issue

I create models in Blender and import the .glb to Babylon. In the past, I used the SceneLoader.ImportMesh function but I wanted to move to the SceneLoader.ImportMeshAsync.

Here is a Playground with both methods:
If you run the bottom one, the old way, it will work. The garment is framed up tight in the window.

If you run the top one with the camera limits in the async, they don’t work at all. If you move them outside the async it does work, the zooming up feature is good but the garment is not centered.

This process only highlights that the async is more accurate because the old code seems to depend on the camera limits being set before the model is completely loaded. That’s a bit dangerous.

How can I use the async method and keep the garment squared and zoomed up to the camera? I would really like to understand what is going on too, if someone could explain.

Thank you for your consideration and time.

Oh wow, that took longer than it should have! :slight_smile:

The result from async is a little different. so you will need to use a different key from the result object:

Dude Walking | Babylon.js Playground (

1 Like

I was looking in the wrong place for a fix. Thank you very much for the quick response.

1 Like