Problem with shadows

I would be really grateful if somebody could help with this.
I am a beginner so any detailed information would be really helpful.

I have uploaded a problem.blend file. This is just an example scene
but the same problem occurs also in the full scale model.

I can see shadows in the Render mode but when I press P shadows
disappear. What am I doing wrong?

could somebody send me back the corrected file?



problem.blend (444 KB)

only a spot light can make shadows and now a sun light from 2.64+
i know i hate that as well

It seems like that your spot lamp is pointing to different direction during the game, so only your sun lamp with no shadow affecting the scene.

I suggest you delete your spot lamp, and activate sun lamp’s shadow.
But if for some reason you need both lamps to stay in there, then here is the blend. I was just move the spot lamp and change its size a little.


problem.blend (445 KB)

Thank you very much for your enlightening answer! However I would like to get some more information…
In the initial file the light is moving in another position when the game starts. This problem occurs also
for the camera in another file that I am working on. Both light and camera move to other position and everything
is drawn black. How do you fix their position (of course not with scripting) through the interface of blender,
so that you make sure that both are in the pre-defined position when the same starts?

Well, I’m not an expert on BGE, and honestly i always had problem myself with ‘Track To’ constraint. So if there is a good way to do that, I hope someone could explain to us how :D. But if it was just me, i’ll use Camera Actuator like this:

  1. Delete your Point Lamp and create a new one. (For some reason the Point Lamp behavior in your scene is a bit odd even after i delete the constraint)
  2. With the new Point Lamp selected, create an Always Sensor and connect it to a Camera Actuator.
  3. For the Camera Object (under Camera Actuator), select the object to point to (eg: Box or Empty).
  4. Set the necessary value under the Camera Actuator, especially for the height and Damping.

Hope it can get you a little bit closer to what you’re looking for.

I guess that the problem with my file was that there was already a constrain between the spotlight and the “empty”…
after removing it, by selecting both > Alt+T > remove constraint + transformation…
and adding the Track To constraint it seems to work fine…

if somebody can explain better he/she is welcome !!!

dConclusionman, thank you very much for your quick response!!!