(Solved) Sun and rotating Spatial

Hello guys,

i have a problem with my sun and a rotating spatial that i created and added to the rootNode.

When i run this application, it rotates the cube, but it seems that the sun is rotating with the cube too. Cube gets sometimes darker and then its turns to normal colors. At the same time the wall just keep the same colors and don’t get darker, it shouldn’t because its an Unshaded Box and covered with custom Texture. Is there sth i just don’t understand with the .obj?



Code below:

[java]Spatial cube;


public void simpleInitApp() {

cube = assetManager.loadModel(“Models/cube.j3o”);

cube.setLocalTranslation(0, 0, 0);

Box box = new Box(Vector3f.ZERO, 2.5f, 2.5f, 1.0f);

Spatial wall = new Geometry(“Box”, box);

Material mat_brick = new Material(

assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);




wall.setLocalTranslation(2.0f, -2.5f, 0.0f);

DirectionalLight sun = new DirectionalLight();

sun.setDirection(new Vector3f(1,0,-2).normalizeLocal());







public void simpleUpdate(float tpf) {



did u export the normals in the .obj?

Your wall wont be affected by light as it is using the Unshaded material

The wall is not the problem, i wrote above that i understand why its not affected, but the cube changes his colors.

The sun is not moving, the cube is moving, so the sun is standing still and i have to get a result every loop like in pic. 1.

But the cube gets darker when it rotates.

I use the cube.j3o, that i turned from cube.obj by double clicking in the JMonkeyEngine IDE.

ill try to export the .obj with normals and will report the changes later.

Another thing to eliminate any odd engine issues would to try a regular JME Box with the lighting material.

…it does sound like your cube lacks normals, though. Without normals, lighting is random.

indeed, the problem where the option in the blender export.

include normals.

Now its doing this what i want.

Thanks guys