I have a simple scene with only one empty box. Within that box I have the camera attached to a scene node, which the user can move (translate/rotate). Additionally a spotlight is attached to the camera's scene node, facing into the same direction as the camera. So when the camera is moved, then the light moves as well.
m_pCamera = m_pSceneMgr->createCamera("Camera"); m_pCamera->setNearClipDistance(0.01); m_pCamNode->attachObject(m_pCamera); Light* spotLight = m_pSceneMgr->createLight("spotLight"); spotLight->setType(Light::LT_SPOTLIGHT); spotLight->setDiffuseColour(1, 1, 1); spotLight->setSpecularColour(1, 1, 1); spotLight->setSpotlightRange(Degree(50), Degree(100)); spotLight->setSpotlightNearClipDistance(0); spotLight->setDirection(m_pCamera->getDirection()); m_pCamNode->attachObject(spotLight);
So, this basically works fine. There is one problem though: As soon as the user moves the camera very close to a side of the box, then suddenly all is black, I can't see anyting. I am sure the camera is NOT moving through the box's side, it is still within the box.
So the problem seems to be that the light does not "work" when it is too close to an object, as if the object (the box side in my case) is not reflecting the light any more.