有人还在问ecplisce的JME3开发环境怎么配,其实文档和教程已经说了:Using any other IDE, create a Java SE project and place jMonkeyEngine3.jar and all JARs from the lib directory on the Classpath. 使用其他IDE工具需要把jMonkeyEngine3.jar包和lib目录下的JARS包加到Classpath下,我的还是做个user lib好。

第一个程序
package jme3test.helloworld;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.math.ColorRGBA;
/** Sample 1 - how to get started with the most simple JME 3 application.
 * Display a blue 3D cube and view from all sides by
 * moving the mouse and pressing the WASD keys. */
public class HelloJME3 extends SimpleApplication {
    public static void main(String[] args){
        HelloJME3 app = new HelloJME3();
        app.start();
    }
//重载simpleInitApp方法,表示为场景添加初始化对象
    @Override
    public void simpleInitApp() {
//声明box立方体,做在世界坐标零点,在三个轴方向都是1倍
        Box b = new Box(Vector3f.ZERO, 1, 1, 1);
        Geometry geom = new Geometry("Box", b);
//加载材质和颜色
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", ColorRGBA.Blue);
        geom.setMaterial(mat);
//附加到根节点,也就是附加到场景中
        rootNode.attachChild(geom);
    }
}

相关文章:

  • 2021-07-18
  • 2022-02-01
  • 2021-11-23
  • 2022-01-01
  • 2021-08-13
  • 2022-02-03
  • 2022-12-23
  • 2021-10-22
猜你喜欢
  • 2021-08-18
  • 2021-05-26
  • 2021-10-02
  • 2021-06-20
  • 2021-12-23
  • 2021-12-30
  • 2021-09-13
相关资源
相似解决方案