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.
|