Camera Follow Example - Jmonkeyengine Typing CST Test
Loading…
Camera Follow Example — Jmonkeyengine Code
Camera follows a moving object.
import com.jme3.app.SimpleApplication;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
public class CameraFollowApp extends SimpleApplication {
private Geometry box;
public static void main(String[] args) {
new CameraFollowApp().start();
}
@Override
public void simpleInitApp() {
Box b = new Box(1,1,1);
box = new Geometry("Box", b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Yellow);
box.setMaterial(mat);
rootNode.attachChild(box);
}
@Override
public void simpleUpdate(float tpf) {
box.move(1 * tpf, 0, 0);
cam.setLocation(box.getLocalTranslation().add(0,5,10));
cam.lookAt(box.getLocalTranslation(), Vector3f.UNIT_Y);
}
}Jmonkeyengine Language Guide
jMonkeyEngine (jME) is an open-source, cross-platform 3D game engine written in Java. It allows developers to create 3D games and interactive applications with full control over rendering, physics, and scene management.
Primary Use Cases
- ▸3D PC games
- ▸Android 3D games
- ▸Educational simulations
- ▸Virtual reality prototypes
- ▸Interactive 3D visualizations
Notable Features
- ▸Java-based development
- ▸Cross-platform deployment (desktop, Android, Web via WebGL)
- ▸Scene graph architecture
- ▸Bullet Physics integration
- ▸Shader support (GLSL/HLSL via OpenGL)
Origin & Creator
jMonkeyEngine was created in 2003 by Mark Powell and a group of open-source contributors to provide a Java-based 3D game engine for hobbyists and developers.
Industrial Note
jME is popular among Java developers seeking a full-featured 3D engine with a scene graph system, built-in physics, and a flexible rendering pipeline, particularly for desktop and Android targets.