Walking through walls

How would i go about stopping the camera walking through walls. My walls are at present just rectangles.



Look up the topic “collision detection” on google or this board.

You have two ways to achieve this :

  • either you use a free 3D engine which deals with that kind of thing;
  • or you start implementing yours ; in that case, you will have to test the position of your camera against :
    • all the walls (simple but not efficient at all)
    • the walls nearby your camera (you must be able to determine which are the walls nearby your camera)

I would personaly recommend the second one, i.e. start writing your own engine, in so far as it will help you understand how these 3D engines work.

Good luck !

Some more topics to look up include BSP, octrees, quadtrees, PVS, portals, bounding boxes, AABB, etc, etc. The list is never-ending!

Ok, I came to a branch this morning, Collision detection, OpenGL programming book (Lighting) or level editor. I have discovered that the level editor and the collision detection require more research, so i will get on with lighting. Some of those terms you just mensioned are later in the book i think.