jMonkeyEngine 3 Tutorial (3) HelloAssets

Hello, I have problems viewing the scene “town” in the tutorial 3.
The first method does not work, while the second method I get the error in the pop-up.

You need to put town.zip in the root project folder

Edit: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:beginner:hello_asset#excercise_-_how_to_load_assets

1 Like

The folder is present in the project but is not recognized.

<cite>@Taurus said:</cite> The folder is present in the project but is not recognized.

Please, take a moment to read the link that @wezrule posted:

Place the town.zip file in the top level directory of your JME3 project, like so:
jMonkeyProjects/MyGameProject/assets/
jMonkeyProjects/MyGameProject/build.xml
jMonkeyProjects/MyGameProject/src/
jMonkeyProjects/MyGameProject/town.zip

Use the following method to load models from a zip file:

Verify town.zip is in the project directory.
Register a zip file locator to the project directory: Add the following code under simpleInitApp() {
assetManager.registerLocator(“town.zip”, ZipLocator.class);
Spatial gameLevel = assetManager.loadModel(“main.scene”);
gameLevel.setLocalTranslation(0, -5.2f, 0);
gameLevel.setLocalScale(2);
rootNode.attachChild(gameLevel);
The loadModel() method now searches this zip directly for the files to load.
(This means, do not write loadModel(town.zip/main.scene) or similar!)

Clean, build and run the project.

1 Like