I am new to jME and 3d programming in general. I am learning by going through the jME tutorials.

In the HelloAnimation tutorial a PointLight rotates around a sphere lighting areas of the sphere towards which it points at any given time during the rotation. I modified the program by introducing another, smaller, sphere which rotates around the PointLight as the PointLight rotates around the large sphere. The light does not seem to be cast on the proper area of the smaller sphere (see the screenshot below). Any idea as to what I’m doing wrong?

Following is the modifed code:

protected void simpleInitGame() {

Sphere s = new Sphere("My sphere", 30, 30, 5);

Sphere s2 = new Sphere("sphere2", 30, 30, .5f);

Node pivot = new Node("Pivot node");

Node pivot2 = new Node("pivot2");

PointLight pl = new PointLight();

pl.setDiffuse(ColorRGBA.red);

pl.setEnabled(true);

this.lightState.detachAll();

this.lightState.attach(pl);

SimpleLightNode ln = new SimpleLightNode("pl node", pl);

ln.setLocalTranslation(new Vector3f(0,10,0));

pivot.attachChild(ln);

pivot2.attachChild(s2);

s2.setLocalTranslation(new Vector3f(0, 2, 0));

Box b = new Box("Blarg",

new Vector3f(-.3f, -.3f, -.3f),

new Vector3f(.3f, .3f, .3f));

ln.attachChild(b);

ln.attachChild(pivot2);

SpatialTransformer st = new SpatialTransformer(2);

st.setObject(pivot, 0, -1);

st.setObject(pivot2, 1, -1);

Quaternion x0 = new Quaternion();

x0.fromAngleAxis(0, new Vector3f(0,0,1));

st.setRotation(0,0,x0);

st.setRotation(1,0,x0);

Quaternion x180 = new Quaternion();

x180.fromAngleAxis(FastMath.DEG_TO_RAD * 180, new Vector3f(0,0,1));

st.setRotation(0,4,x180);

st.setRotation(1,4,x180);

Quaternion x360 = new Quaternion();

x360.fromAngleAxis(FastMath.DEG_TO_RAD * 360, new Vector3f(0,0,1));

st.setRotation(0,8,x360);

st.setRotation(1,8,x360);

st.interpolateMissing();

pivot.addController(st);

pivot2.addController(st);

rootNode.attachChild(pivot);

rootNode.attachChild(s);

}

Thanks.