Assests Outside Project

Guys is there a way to load .j3o files outside of assests folder in the project?

Ok the solution below works fine :
[java]assetManager.registerLocator(folderPath, FileLocator.class);[/java]

However there is a little problem. By implementing this approach, you only create two different assets locations for assetsManager. Therefore, if you have the same .j3o file in both the default location and the new location of assets folder, you will get the file in the default location. What it does basicly that it stores locations in an array when you call registerLocator method. By default, the array is like this: [defaultAssetsLocation]. After registration, it becomes [defaultAssetsLocation, newAssetsLocation] and when you load a .j3o, it searches the file on those locations one by one. When it matches, it returns that file. Thus, if you have two .j3o files with a same name in those locations, it will return the file in the first location which is defaultAssetsLocation. You should aware of it :wink:

This is what I understood. If there is a mistake with my point of view please inform me and us.

Thank you.

Try this:

[java]
assetManager.registerLocator(folderPath, FileLocator.class);
[/java]

Then you can load assets of any external folder. But all assets will have relative path.

1 Like

Thanks but I have tries this before and it did not work. I say not working because the folderPath does even not exist and the game is still able to load j3o objects :S

Here is a little piece of the code:

[java]
assetManager.registerLocator(ASSESTS_PATH, FileLocator.class);
if (piece.getType().equals(“B”)) {
return assetManager.loadModel("/Models/b.mesh.j3o");
[/java]

It still returns the object from the assests folder in the project.

So maybe you have the folder on the classpath in your project?