Enable javascript to see screen shots.

prev next

3d Collision Engine

Project Members:
Programmer: Jason Eaton

Languages: C++
Libraries: Ogre3d

Date Added: 10/6/2007
File Size: 3,509k, 6,870k
Download: NinjaBin.zip, NinjaMedia.zip
(unzip both files to one directory)

I've used a few physics engines for attempting to crate a 3d game, but the ones available to me tended to be very quirky and I didn't need to simulate interactions so exactly. So I set out to crate a collision detection scheme that was much more simple but had much more consistency in the reactions between objects. I studied many 2d games and tried to make a 3d version that had a similar feel to the 2d ones. This resulted in me using cylinders as avatars, since most of the time characters would be upright and would need to turn around on the ground plane at all angles. This way the collision shape would never change no matter what way the character was facing. The collision portion of this demo was created from scratch.

A very good source for 2d collision detection is the metanet software tutorials designed to illustrate how the flash game "N" was designed. I used the separating axis therom (SAT) like the tutorials suggest, and converted the algorithms to 3d. I set up the map as a 3d grid, and created functions for each type of block. I was implementing 3d versions of the shapes that were used in N, so far in this demo, only the top row is implemented. The 3d versions of the shapes turn out to increase the complexity of the algorithm more than I had anticipated.

A lot of strange things happen when you use a simple shape to represent your avatars, which I discuss in my Collision Detection and Response paper about 2d tile based games. In order for cylinder characters to walk up ramps without looking strange, the cylinders have to penetrate the ramps because normally in 2d games the center of the box would be used as the height the character would be standing. This also creates issues with boxes needing to be passable from different directions at the top of these ramps. I haven't implemented anything that fixes those problems in this demo, but there are a few versions of the demo included in the download. One issue SAT has is objects tend to slide down ramps, so for two of the demos I added a fix to have objects be able to be at rest on the ramps. It also makes ramps easier to climb.