[SOLVED] Loading .j3o after build from seperate folder

Is it possible to load models from a folder that isn’t built into the game.

Yes.

1 Like

Nice! Next question, how do you load assets from a folder outside the assets folder.

You can register a loader with the assetmanager:

assetManager.registerLocator("/Users/user/my-models", FileLocator.class);

the /my-models folder can now be used as a ‘root’ folder for the asset manager.

Let’s say you have a model at /Users/user/my-models/firetruck.j3o, you can load it as usual:

assetManager.loadModel("firetruck.j3o");

edit: all of this is clearly mentioned in the wiki, it’s good practice to go over the wiki first: https://wiki.jmonkeyengine.org/jme3/beginner/hello_asset.html#loading-assets-from-custom-paths

2 Likes

You can also use BinaryImporter directly if you make sure to pass it the right asset manager.

…but for most use-cases the asset manager locator is the right way to go.

Cheers. I looked through the wiki and, being the fool I am, completely missed that part.

1 Like