(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?



http://i.imgur.com/D1vdF.png

http://i.imgur.com/X8lQa.png



Code below:



[java]Spatial cube;



@Override

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”);

mat_brick.setTexture(“ColorMap”,

assetManager.loadTexture(“Textures/wall.jpg”));

wall.setMaterial(mat_brick);

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



DirectionalLight sun = new DirectionalLight();

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

sun.setColor(ColorRGBA.White);



rootNode.addLight(sun);

rootNode.attachChild(wall);

rootNode.attachChild(cube);



}



@Override

public void simpleUpdate(float tpf) {

cube.rotate(tpf,0,0);

}[/java]

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