My problem now is if I am standing with the wall to my left or right side. I can still see through the wall into the room next to me. It doesn't matter how thick I make the wall because the entire thing isn't drawn. It doesn't matter how close my camera is to my character, since it doesn't change the camera's distance from the wall. In fact my camera can be at my character's position and I still see thru the wall. Bumping the camera to the left or right wouldn't make any difference either, if I were in a narrow hallway with walls on my left and right.
I'm able to detect when this is happening with the following code in my camera's update loop:
Code: Select all
const irr::scene::SViewFrustum* f = camera->getViewFrustum();
vector3df ul, lr, ll, ur;
f->planes[irr::scene::SViewFrustum::VF_NEAR_PLANE].getIntersectionWithPlanes(
f->planes[irr::scene::SViewFrustum::VF_TOP_PLANE],
f->planes[irr::scene::SViewFrustum::VF_LEFT_PLANE], ul);
f->planes[irr::scene::SViewFrustum::VF_NEAR_PLANE].getIntersectionWithPlanes(
f->planes[irr::scene::SViewFrustum::VF_BOTTOM_PLANE],
f->planes[irr::scene::SViewFrustum::VF_RIGHT_PLANE], lr);
f->planes[irr::scene::SViewFrustum::VF_NEAR_PLANE].getIntersectionWithPlanes(
f->planes[irr::scene::SViewFrustum::VF_TOP_PLANE],
f->planes[irr::scene::SViewFrustum::VF_RIGHT_PLANE], ur);
f->planes[irr::scene::SViewFrustum::VF_NEAR_PLANE].getIntersectionWithPlanes(
f->planes[irr::scene::SViewFrustum::VF_BOTTOM_PLANE],
f->planes[irr::scene::SViewFrustum::VF_LEFT_PLANE], ll);
if (collisionMgr->getSceneNodeAndCollisionPointFromRay(irr::core::line3df(ul, lr),
outCollisionPoint, outTriangle, ESceneNodeFlag::wall) ||
collisionMgr->getSceneNodeAndCollisionPointFromRay(irr::core::line3df(ll, ur),
outCollisionPoint, outTriangle, ESceneNodeFlag::wall))
{
cout << "Looking thru a wall!" << endl;
}Any ideas? This has to be a problem with any 3D irrlicht application, somebody has to have solved it..