Due: Tuesday, October 30, 2001 (2 weeks) in the assignment box before midnight, or during demo time
Collision Detection
Add BSP tree collision detection facilities for static objects and ignore vehicles for this assignment. Generally speaking, the bulk of the work is in your builder. You need to precompute collision detection information for the world and output it so that your engine has access to it.
For player movement, perform two collision detection tests: (1) Perform one test when moving from a point at the player's height to a new point at the same height. If there is a collision, go only as far as permitted (or a little less). (2) Perform a second collision detection test when you attempt to move down say by 1 meter. If you do not hit anything, go down a little. If you do, place yourself at the player's height above the hit point. This will allow you to walk up and down stairs or along sloping "terrain".
Extensions:
1. (EASY) Make collision detection work when you hit a dynamic object (a teapot or a vehicle). Just transform the box points in local coordinates to world coordinate using the object's transformation and determine if your movement intersects the box...
2. (HARD) Make collision detection work when you are driving a vehicle too. This is a little harder since the object that is moving is not a point. Box intersection with box is not hard (so it's easy to see if a collision occurs with another dynamic object). Box intersection with a plane in a BSP tree is harder. You'd have to come up with a special algorithm since it wasn't discussed in the notes. One approach is to use 6 point collision tests (one for moving each corner point).