We start with a simple game that loads a model of a town:
Make a copy of
Main.java
and name the classPhysicsTown.java
. Remember to also refactor the first line of themain()
method to the following:PhysicsTown app = new PhysicsTown();
Download a sample town model in the Ogre DotScene format from http://jmonkeyengine.googlecode.com/svn/trunk/engine/town.zip. Save it directly into your project directory (not into
assets/
).Register a
com.jme3.asset.plugins.ZipLocator
fortown.zip
to theassetManager
. Now you can use theassetManager
to load the model'smain.scene
into thesceneNode
class field. Since the model is quite small, scale it a bit bigger. As always, you attach the loaded model to therootNode
. Remember to add light sources to the scene.private Node sceneNode; public void simpleInitApp() { assetManager.registerLocator("town.zip", ZipLocator.class); sceneNode = (Node)assetManager.loadModel("main.scene"); sceneNode.scale(1.5f); rootNode...