Get loading rate when importing meshes with GLTFString

Hi,
I want to display the progress of importing a model on my loading screen. Is there a way to get the loading rate when importing via GLTF String?

BABYLON.SceneLoader.ImportMesh('', '', `data:${glTFDataString}`, scene, (...), 
(event) => updateProgress(event, "import"))

I got this onProgress handler and the length is always not computable.

function updateProgress(event, state?:string) {
  var percentComplete;
  if (event.lengthComputable) {
    percentComplete = event.loaded / event.total * 100;
  } else {
    var dlCount = event.loaded / (1024 * 1024);
    percentComplete = Math.floor(dlCount * 100.0) / 100.0;
  }
  console.log(percentComplete.toFixed(2) + "%")
}
1 Like

Hello and welcome!

this is because your server does not send the info :frowning: It is not something we can control from the client side unfortunately