CPE 471 Final Project: Collision Detection


Collision detection is the basis of almost all interactive graphical programs. Without it video games wouldn't really exist as things would just go through each other. There are many ways to implement hit detection but I chose the simples due to time contraints.



Program Description

Collision detection is done in many different ways. Objects are essentially bounded by another virtual like object (a box, sphere, or cylinder). When one object comes to the boundery of another object a collision has occured, from here one can choose what to do. Reflections about the collision point is what I did.

My program has two types of collisions, box on box, and box on plane. Each object is represented by a box, while the ground is essentially a plane. Upon hitting another object the sphere bounced in a path backwards from the object. I did not have time to correctly implement the reflection of a sphere on another object. As it is now all objects bounce correctly but always back in the direction of their origin. I fully textured every object in the world to give a more realistic look. The spheres also rotate in the direction that they were thrown. The camera also has collision detection, spheres bounce of the camera and the user, with the exception of the balls, cannot pass through objects. I also implemented a gravity aspect so the balls fall gradually to the ground after they're launched and bounce around, one ball can also transfer momentum to another ball if they both hit. Though there is a small glitch where if two balls stack on each other they go flying.

For performance I used a display list to draw the initial world with all static objects in place. Culling was also used.




Using my Program

Keyboard Controls:
w : moves forward
a : strafes left
d : strafes right
s : moves backward
q : quits application
c : toggles camera movement on/off
f : launches a ball in the direction of the cameras look at point

Mouse Controls:
For camera movement left mouse button must be pressed




Sources

NeHe Productions - Lesson 30
CG Textures




Screen Shots