• Content Count

  • Joined

  • Last visited

  1. Sorry, I should have clarified this earlier - I understand relative directories above the existing directory - its what I did not want to do (if my route changes in the future from /app/testbabylon to /app/somethingelse/babylon, all those links are broken unless I also move the assets). Going to mark this as resolved since its better for my case to use absolute paths anyways, which I've already done and it works fine.
  2. Thanks for the reply - I think what you're referencing in http://www.babylonjs-playground.com/#28G6UT#45 is slightly different than my case. Checking the window.location of that link gives a pathname property of "/" (the hash property is "#28G6UT#45"). A relative reference would only use the pathname and not the hash (I think - I'm not entirely sure about that). I think something more similar would be trying to use the sandbox https://babylonjs.azurewebsites.net/sandbox/ and trying to access a texture from 'https://babylonjs.azurewebsites.net/assets/texture.jpg' using only the path string '/assets/texture.jpg' and not the absolute url. I don't know if the sandbox would support something like that (don't have too much experience using it). Anyways, I was able to get around the issue entirely last night by using a dynamic configuration that provides the correct base url for me. Thanks, Flux159
  3. Hi! I've been using Babylon for a week or so now and really like how easy it is to use and how well the tutorials are written (I'm using it for a robotics simulation project I'm currently working on). Anyways, I have a question about how textures (and other AssetTasks as well: https://github.com/BabylonJS/Babylon.js/blob/master/src/Tools/babylon.assetsManager.ts) are loaded using the AssetManager. I have a texture image that's being served at /app/assets/sceneassets/mytextureimg.jpg. My Babylon scene is loaded at the url /app/testbabylon. When I try to load a texture using the addTextureTask method of the AssetManager, I specify that the asset is located at "/app/assets/sceneassets/mytextureimg.jpg", however, the network request that the AssetManager makes is to "/app/testbabylon/app/assets/sceneassets/mytextureimg.jpg". This is clearly relative to my current path, I can use an absolute path (in dev: "http://localhost:4000/app/assets/sceneassets/mytextureimg.jpg") and it works correctly, however this seems messy (especially if switching domains). If I end up using "//app/assets/sceneassets/mytextureimg.jpg" the network request is "http://app/assets/sceneassets/mytextureimg.jpg" - which doesn't point to anything. My main question is whether its possible to specify the AssetManager to use the root url of my domain for texture (and/or image, cubetexture, etc.) loading (or have something like a "rootUrl" parameter like AddMeshTask seems to have). Just for reference, here's a snippet of the code I'm using (material is an object that has a name and diffuseTexture property; where diffuseTexture is the url string, scene is a Babylon Scene object). setupMaterial(material, scene) { const babylonMaterial = new Babylon.StandardMaterial(material.name, scene); if (material.diffuseTexture) { const diffuseTask = scene.loader.addTextureTask( `diffuseTextureTask${material.name}`, material.diffuseTexture); diffuseTask.onSuccess = (task) => { babylonMaterial.diffuseTexture = task.texture; }; } return babylonMaterial; } Thanks for any help, Flux159