Have fun 
package jmetest.TutorialGuide;
import com.jme.app.SimpleGame;
import com.jme.scene.TriMesh;
import com.jme.scene.Node;
import com.jme.scene.state.TextureState;
import com.jme.scene.shape.Sphere;
import com.jme.animation.SpatialTransformer;
import com.jme.math.Vector3f;
import com.jme.math.Quaternion;
import com.jme.math.FastMath;
import com.jme.bounding.BoundingSphere;
import com.jme.util.TextureManager;
import com.jme.image.Texture;
import java.net.URL;
/**
* Started Jan 25, 2005
*
*
* @author Jack Lindamood
*/
public class HelloSolarSystem extends SimpleGame {
public static void main(String[] args) {
HelloSolarSystem app = new HelloSolarSystem();
app.setDialogBehaviour(SimpleGame.ALWAYS_SHOW_PROPS_DIALOG);
app.start();
}
TriMesh sun, earth, moon;
Node centSolar, centEarth, centMoon;
protected void simpleInitGame() {
BoundingSphere.useExactBounds = true;
sun = new Sphere("Sun", 15, 15, 20);
sun.setModelBound(new BoundingSphere());
sun.updateModelBound();
earth = new Sphere("earth", 15, 15, 4);
earth.setModelBound(new BoundingSphere());
earth.updateModelBound();
moon = new Sphere("moon", 15, 15, 2);
moon.setModelBound(new BoundingSphere());
moon.updateModelBound();
centSolar = new Node("Center of solar system");
centEarth = new Node("Center of the earth");
centMoon = new Node("Center of the moon");
centSolar.attachChild(sun);
centSolar.attachChild(centEarth);
centEarth.attachChild(earth);
centEarth.attachChild(centMoon);
centMoon.attachChild(moon);
// centEarth.setLocalTranslation(new Vector3f(60,0,0));
// centMoon.setLocalTranslation(new Vector3f(8,0,0));
rootNode.attachChild(centSolar);
Quaternion qzero = new Quaternion();
qzero.fromAngleAxis(0, new Vector3f(0, 1, 0));
Quaternion qone = new Quaternion();
qone.fromAngleAxis(FastMath.DEG_TO_RAD * 120, new Vector3f(0, 1, 0));
Quaternion qtwo = new Quaternion();
qtwo.fromAngleAxis(FastMath.DEG_TO_RAD * 240, new Vector3f(0, 1, 0));
Quaternion qthree = new Quaternion();
qthree.fromAngleAxis(FastMath.DEG_TO_RAD * 360, new Vector3f(0, 1, 0));
SpatialTransformer years = new SpatialTransformer(1);
years.setObject(centSolar, 0, -1);
years.setRotation(0, 0, qzero);
years.setRotation(0, 118, qone);
years.setRotation(0, 236, qtwo);
years.setRotation(0, 356, qthree);
years.interpolateMissing();
centSolar.addController(years);
centEarth.setLocalTranslation(new Vector3f(60, 0, 0));
SpatialTransformer days = new SpatialTransformer(1);
days.setObject(earth, 0, -1);
days.setRotation(0, 0, qzero);
days.setRotation(0, .333f, qone);
days.setRotation(0, .666f, qtwo);
days.setRotation(0, 1, qthree);
days.interpolateMissing();
earth.addController(days);
SpatialTransformer lunarMonths = new SpatialTransformer(1);
lunarMonths.setObject(centMoon, 0, -1);
lunarMonths.setRotation(0, 0, qzero);
lunarMonths.setRotation(0, 1, qone);
lunarMonths.setRotation(0, 2, qtwo);
lunarMonths.setRotation(0, 3, qthree);
lunarMonths.interpolateMissing();
centMoon.addController(lunarMonths);
moon.setLocalTranslation(new Vector3f(8, 0, 0));
URL monkeyImage = HelloSolarSystem.class.getClassLoader().getResource("jmetest/data/images/Monkey.png");
TextureState ts = display.getRenderer().createTextureState();
ts.setTexture(TextureManager.loadTexture(monkeyImage, Texture.MM_LINEAR, Texture.FM_LINEAR, true));
earth.setRenderState(ts);
moon.setRenderState(ts);
display.getRenderer().getCamera().setFrame(new Vector3f(30, 0, -50), new Vector3f(1, 0, 0), new Vector3f(0, 1, 0), new Vector3f(0, 0, 1));
lunarMonths.setSpeed(5);
days.setSpeed(5);
years.setSpeed(5);
}
}