2. Objectives Implement Plane to Sphere collision detection Sphere to Sphere collision detection Collision Response
3. Sphere to Sphere Collision Detection If sphere1 & sphere2 collide n = c2 – c1 |n| <= r1 + r2 depth = |n| - (r1+r2) normal = n / |n| c2 r2 n r1 c1
4. Plane to Sphere Collision Detection Forming a plane Compute normal by 3 vertices, p1, p2, p3 normal = (p2-p1) x (p3-p1) If plane and sphere d = c1 * plane’s normal d <= p + r normal = plane’s normal depth = p + r - d c1 d p
5. Collision Response Simulate response From Physics, we know…. As original Velocity can be de-composited to two part V1, V2 V2 will remain the same but V1 will flip Vnew = Vold – 2* (Vold * Normal)*Normal How about stickiness? normal Ori. velocity c1 V1 V2
6. Tasks Task 1 Plane to Sphere collision detection Fill in boolcheckCollide(BoundSphere *n1, BoundPlane*n2, float dt, ContactInfo *ci) Some notes: BoundSphere & BoundPlane are just simple structure holding normal, radius… Please look into ContactInfo as returning these info will help you adding collision response Task 2 Collision Response Fill in void checkCollision() Some notes: Work on sphere to plane collision response But other responses are similar
7. Thanks Hope you enjoy this laband find it useful for your assignment 4