Loading the meshes straight from the Ogre Mesh or Wavefront file is something that you only do for testing purposes. When you load a model from a .mesh.xml
or .obj file
, jMonkeyEngine converts it internally into an optimized binary format called .j3o
.
If you have made up your mind to use a certain model in your game, you convert it to .j3o
, and only load the .j3o
file:
In the jMonkeyEngine SDK's Project window, browse to the
assets/Textures/MyModel/
directory.Right-click on
mymodel.mesh.xml
and choose Convert to j3o Binary from the context menu. The SDK createsmymodel.j3o
.Move
mymodel.j3o
into theBasicGame/assets/Models/MyModel/
directory.Open
LoadModel.java
again. Keep the light source insimpleInitApp()
.Replace the
load()
path insimpleInitApp()
with the following code:Spatial mymodel = assetManager.loadModel( "Models/MyModel/mymodel.j3o"); rootNode.attachChild(mymodel);
Run the
LoadModel
sample. The j3o version of the model should load...