Importing gltf models


I have 3 questions about using and importing models.

SceneLoader.ImportMeshAsync("myModel", "./src/models/squelette_lourd/", "scene.gltf", scene)
How can i get webpack variable (import statement) leading to the folder of the model as it is needed in 2nd parameter of importMeshAsync function? As you can see now I am using dev-mode source path but this wont work after build. Or maybe there is some other way?

When I import the model I get animation groups and then I control animations with play/stop functions. I noticed that there is something like “onAnimationLoopObservable” and i would like to attach an event when animation loops.

I read a topic on the forum that the best way to copy model with all its skeletons and animationGroups is to just import it couple times. Is it true? Or it was some outdated information?


  1. You have to export your paths. We cannot assume the folder structure unfortunately :frowning:
  2. What is the question? :slight_smile:
  3. Nope totally right, you will reuse browser cache so it will be fast

Thanks for your answer :grin:

  1. But how can I get export path leading to a folder not a file? I can
    import "./src/models/squelette_lourd/scene.gltf"
    but not
    import "./src/models/squelette_lourd/"
    via webpack

  2. I get animation end and start but onAnimationLoopObservable is not working in my code. I will try to reproduce this in playground and then maybe start another topic

  3. ok thx

  1. I think you are forced by webpack to import each file
  2. Yes please that would be easier