Problem following introductory tutorial locally (relative file paths)

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/”:

https://doc.babylonjs.com/features/introductionToFeatures/chap3/import_character/

Similarly, in chapter two a sound is brought in as “sounds/cellolong.wav”:

https://doc.babylonjs.com/features/introductionToFeatures/chap2/sound/

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?

https://doc.babylonjs.com/features/introductionToFeatures/chap2/sound/

Do you run some webserver? It works only this way

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 :grinning: too aggressive sometime

1 Like

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:

https://assets.babylonjs.com/meshes/both_houses_scene.babylon

Not the best thing to use as it has a 10-min cache. You will not see your changes immediately.

Sorry, now I don’t understand :smiley: Do you see your assets in github pages? Do you know where is it? Do you have urls to your assets on github pages?

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.

Here is the tutorial page:
https://doc.babylonjs.com/features/introductionToFeatures/chap2/sound/

Here is the tutorial playground:

When in a playground, the relative assets are relative to the playground/public/ folder. So, sounds are inside packages/tools/playground/public/sounds/.

1 Like

Ah, good to know! How does that translate into a URL though? For example would it be

http://babylon.js/public/sounds

Or something else?

more like playground.babylonjs.com/sounds in that case

Aha, that was it! Thanks!

You can see these urls in a browser’s devtool (pressing F12).