The provided assets
directory contains the Models/HoverTank/Tank.j3o
model.
Copy
Tank.j3o
and its four textures into a newassets/Models/HoverTank/
directory in your project.Make a copy of
Main.java
and name the classHoverTank.java
. Remember to also refactor the first line of the main() method toHoverTank app = new HoverTank();
.Replace the blue cube code in the
simpleInitApp()
method with the following:Node tank = (Node) assetManager.loadModel( "Models/HoverTank/Tank.j3o"); Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); TextureKey tankDiffuse = new TextureKey("Models/HoverTank/tank_diffuse.jpg", false); mat.setTexture("DiffuseMap", assetManager.loadTexture(tankDiffuse)); tank.setMaterial(mat); rootNode.attachChild(tank);
Run the code. You should see a textured sci-fi vehicle with a monkey logo.