I am working through the introductory tutorial locally (not using sandbox) and I have a simple problem. I don’t know how to load or access files that are referenced with relative paths. For example, I am working through chapter three this morning and the character animation is brought in as “/scenes/Dude/”:
I tried to look for the full file path using my browser developer tools but I could not find it. Does anybody have any advice? Is there a babylon or javascript function that converts these relative paths to the resulting absolute paths?
Simpliest option: python -m http.server 8000 in your working dir. And run it in a browser: http://localhost:8000
But this option works very bad sometimes when it comes to cache too aggressive sometime
Oh, I am already using a server (github pages) but the problem is I have no idea how/where to find these files since they are only listed as relative paths like this:
“/scenes/Dude”
instead of earlier lessons where they are listed like this and I could grab them:
It’s no problem, I am probably explaining poorly. Here is a concrete example. In the second chapter of the tutorial, they play a sound using the following line of code:
const music = new BABYLON.Sound("cello", "sounds/cellolong.wav", scene, null, { loop: true, autoplay: true });
My problem is that I have no idea how to download the file cellolong.wav. Once I download the file, I can take it from there but because it is a relative path (“/sounds/cellolong.wav”) instead of an absolute path (“http://path/to/sounds/cellolong.wav”) I have no idea where to download it from.
When in a playground, the relative assets are relative to the playground/public/ folder. So, sounds are inside packages/tools/playground/public/sounds/.