HW 2: Physics & Collision Detection, and Modularization
Assigned Thursday 2/09/17 midningt.
Due Wednesday 2/15/17 before midnight.
The objective will be to entail more advanced physics. It will be 2 tasks, the first will entail contrasting change of force fields compared to an implemented forcefield. The second task will study collision and how to detect and display the collisions effiently. The hackathon following the due date of this HW will require/expect/assume you have done did this task on time.
Task 1: Particle from Air to Mystery Substance and Beyond!
A particle or ball is dropped into water, as it is dropped into water (by mouse) it's velocity slows down. It is less dense and water and eventually floats in a resting position. This behavior is depicted in the javascript for the left most canvas code (here, and figure below). Zip file of code is available ( here ). Only the water behavior has been implemented. Your job is to make the behavior work for the other canvases as well: oil and air. You will also need to modularizing the code better to work with additional canvases, e.g., variables should only be 'global' with respect to the particular canvas. Consider using arrays and objects to make the code more 'modularized'.http://cobweb.cs.uga.edu/~maria/classes/4070-Spring-2017/HW2/HW2.html
Task 2: In-Elastic or Elastic that is the Question?
Read about elastic collision on Wikipedia ( here ). Check out this local copy of Adam Brookes' implementation in javascript / HTML5 Canvas ( here ), and read his tutorial of his code ( here.pdf ) local copy.
Below is a flash tutorial, basic introduction using AABB collision boxes (straight forward reading):
Game Development-tut-plus (here)
Advanced Collision Detection (Read)
Collision detection using the separating axis theorem ( see here )
Further Reading: In-Elastic Collision
http://en.wikipedia.org/wiki/Inelastic_collision
https://www.youtube.com/watch?v=mhIOylZMg6Q
http://hyperphysics.phy-astr.gsu.edu/hbase/inecol.html#c1
Task 1 a) | Implement traveling into Oil or Air | |
Task 1 b) | Can you 'gamify' this task? | |
Task 2 a) | Use the local code copy of Adam Brooke's as a template, and add the visual of collision points (depicted by blue circles) described in the AABB collision tutorials. | |
Task 2 b: | Make it look more cooler, e.g., change color of balls on impact, add a sprite for collision site, make it inelastic. |
Submission:
submit HW2 csx070
Use capital letters for H and W.
and email: maria.hybinette@mac.com
Please submit your work on nike.cs.uga.edu.