Java examples for Game:JME3
Load jme3 Model
package IOmethods; import com.jme3.app.SimpleApplication; import com.jme3.light.DirectionalLight; import com.jme3.material.Material; import com.jme3.math.ColorRGBA; import com.jme3.math.FastMath; import com.jme3.math.Quaternion; import com.jme3.math.Vector3f; import com.jme3.renderer.RenderManager; import com.jme3.scene.Geometry; import com.jme3.scene.Spatial; import com.jme3.scene.shape.Box; /**/*from ww w . j a va 2 s . c o m*/ * test * * @author normenhansen */ public class LoadModel extends SimpleApplication { public static void main(String[] args) { LoadModel app = new LoadModel(); app.start(); } @Override public void simpleInitApp() { //Spatial mymodel = assetManager.loadModel("Textures/MyModel/mymodelAnimated.obj"); Spatial mymodel = assetManager .loadModel("Models/MyModel/mymodel.j3o"); //rootNode.attachChild(mymodel); Quaternion roll180 = new Quaternion(); roll180.fromAngleAxis(FastMath.PI, new Vector3f(0, 1, 0)); mymodel.rotate(roll180); rootNode.attachChild(mymodel); DirectionalLight sun = new DirectionalLight(); sun.setDirection((new Vector3f(-0.5f, -0.5f, -0.5f))); sun.setColor(ColorRGBA.White); rootNode.addLight(sun); } @Override public void simpleUpdate(float tpf) { //TODO: add update code } @Override public void simpleRender(RenderManager rm) { //TODO: add render code } }