Hi,
I'm having a problem with a spotlight that lit a sphere on the opposite face, I hope it's nothing big, however, I don't really know what's wrong with my code:
my shpere is created this way (lambda is a dimensional constant, myDungeon is the main spatial Node attach to rootNode)
private void CreateSphere(){
Sphere mySphere = new Sphere("sphere", new Vector3f(12*lambda, 4*lambda,24*lambda),3*lambda,3*lambda,5);
MaterialState ms = display.getRenderer().createMaterialState();
ms.setColorMaterial(MaterialState.CM_AMBIENT_AND_DIFFUSE);
ms.setDiffuse(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
myDungeon.attachChild(mySphere);
}
my lights are like this
private void InitLights(){
PointLight light = new PointLight();
light.setAttenuate(true);
light.setQuadratic(0.05f/(lambda*lambda));
light.setDiffuse(ColorRGBA.red);
light.setEnabled(true);
light.setLocation(new Vector3f(120.0f*lambda,100.0f*lambda,180.0f*lambda));
lightState.detachAll();
lState = display.getRenderer().createLightState();
lState.attach(light);
lState.setEnabled(true);
lNode = new SimpleLightNode("light ceiling", light);
lNode.setLocalTranslation(new Vector3f(12.0f*lambda,2.0f*lambda,18.0f*lambda));
rootNode.attachChild(lNode);
rootNode.setRenderState(lState);
rootNode.updateRenderState();
}
and i call CreateSphere() before InitLights()
on the picture you can see the light source (point light) is in the right bottom corner, and the sphere is up left, and this is the upper left half of the sphere which is litten
[IMG]http://img218.imageshack.us/img218/443/wronglightingjq5.th.jpg
Thanks,
Adrien