OpenGL SAT Assessment

Due Date 8th November 5:00pm 10th November 1pm. zip up the project and add it to Blackboard (go to "Project Upload"/ "OpenGL SAT assignement " and attach the file there.

 

 

BouncingTriangle

  1. Create a SFML/OpenGLProject.
  2. Add a class called "BouncingTriangle".
  3. The BouncingTriangle class will be reponsible for drawing a Trianglular shape in the on the screen.
  4. It is important that this class keep track of the locations of the corners of the object! Later on you will need to be able to get the screen coordinates of the corners.
  5. The triangle should be given some initial velocity and position and move across the screen. The Triangle should bounce off the edges of the screen.
  6. Add 10 BouncingTrangles to your project with different initial conditions.

BouncingBox

  1. Create another class in the project called "BouncingBox"
  2. This class will draw a bouncing rectangular box.
  3. The box should be rotating (i.e. have some angular velocity) and have some initial velocity and position.
  4. Again it is important that this class keep track of the locations of the corners of the box! Later on you will need to be able to get the screen coordinantes of the corners.
  5. Add 10 Bouncing boxes to your project each with different initial conditions.
  6. Watch with amazement at your creation.

Both BouncingBox and BouncingTriangle should be subclasses of a BouncingThing.

Collsion detection

  1. Create a class called "CollisionDetection". This class contains a static method called CheckForCollisionSAT(), which takes two BouncingThings as parameters.
  2. The method CheckForCollisionSAT() should get the following from each of the bouncing things
    1. list or array of separating axes (SA)to test
    2. list or array of screenspace coordinates of the vertices
  3. This method should then project the vertices onto each SA and check for overlap.
  4. If there is an overlap on all SAs, the function should return true, otherwise false.
  5. Have the application call this function on all potentially colliding pairs of objects and perform some suitable collsion response.

Optimisation

You should make some effort to optimise this application. Please make a note of your maximum frame rate before and after optimising. Ideas include a combination of;

  1. Ensure each pair is only being tested at most once per frame (you'd be surprised how often this is overlooked)
  2. Broad phase analysis
  3. Take advantage of seperation coherence

 

Assessment rubric

Assessment scheme is here.