Collision in a 3D World

I have recently been working on a small top-down grid-based 2D game. As part of an experiment I figured it to be fun to convert the 2D representation of an automatically generated level to 3D, similar to Wolfenstein 3D's style (as an example, I'm not actually using Raycasting).

Converting the grid to quads with textures is not that much of a problem, however, I'm kind of stuck on how to implement collision. I've been browsing the Internet for articles for 2 days now but none has really given me a good starting point in how to prepare my 3D world for collision and how to actually implement it.

Does anyone know any good articles for me to read, or maybe even care to write a small excerpt of steps I have to go through?

I'm writing the game in XNA/C#, however, any type of resource you might know is welcome (be it C++ or whatever else).


The way Wolfenstein 3D (and similar) handle collision detection is simple: the map is a uniform square cells map. Wolf3d subdivided the cells in (if memory serves me correctly) 64x64 sub units to allow the player to gracefully glide through the maze. For collision detection it is sufficient to check the position of the player to cells of the grid, if the cell contains a blocking obstacle (table, wall, dog, door): block otherwise: move on.

If you are looking for diagonals and other random polygons, have a look at articles on Portal engines. The step from Wolf3D cells to Doom/Quake BSP Trees is a big one but there are quite a few good articles by Jacco Bikker at the bottom of the Flipcode archives Read those!

链接地址: http://www.djcxy.com/p/95494.html

上一篇: Java中的LWJGL等C ++游戏库/引擎

下一篇: 3D世界中的碰撞