I have a custom .json file saved locally that defines my particle system.
When I set ParticleHelper.BaseAssetsUrl to my local public folder the json loads fine but then the texture that is defined as “textureName”: “flare.png” in json file is trying to load from https://assets.babylonjs.com/particles/textures even tho BaseAssetsUrl is set to my local directory.
To the level I was able to understand the source code, static variable BaseAssetsUrl is only used in ParticleHelper class and when the json is loaded end sent to ParticleSystemSet parse method there is no reference to BaseAssetsUrl. The parse methods always takes Constants.PARTICLES_BaseAssetsUrl value. I think ParticleHelper.BaseAssetsUrl should be injected into Parse methods for ParticleSystemSet and ParticleSystem classes.
I was thinking to change Constants.PARTICLES_BaseAssetsUrl but this seems like to much of a hack…
@Deltakosh
Actually, now I tried this solution but it seems it doesnt work. This is a read only property so you cant change it programatically. Any way around this?
interesting, when I switch to that property, it seems to be effective.
However, before I can find out babylon can no longer find (404) the following json file which normally does not show up in the source panel.
/systems/explosion.json
Alright, found that json file and added it to my local server as well.
Now I notice, it’s still defaulting to assets.babylonjs.com.
(when i turn off my internet connection, the images are missing)
Is this the expected behavior?
I think I found a simple solution for this after looking at the source code snipped that @Deltakosh posted.
I’ve also been having a similar issue with not being able to change BABYLON.Constants.PARTICLES_BaseAssetsUrl:
When just changing the url for BABYLON.ParticleSystemSet.BaseAssetsUrl instead it works just fine and loads the textures offline from the project folder.
Thanks @Stephen I reread your solution and that was the ticket.
However, I had to use different strings as bbjs appends the two variables when creating the path to the textures for the particles.