Collision Detection and Resolution

Tom Kelliher, CS 320

Feb. 25, 2005

Administrivia

Announcements

Assignment

Read Section 4.1, Appendices B and C.

From Last Time

Vectors.

Outline

  1. Continued discussion of collision.c: ball placement, collision detection, collision resolution.

Coming Up

Animation.

collision.c

  1. placeBalls():
    1. Placement of the first ball along unit circle.

      Velocity computation. Target: origin. Scaling velocity.

      Translating position to circle of radius 40.

    2. Avoiding initial collision: Constrained placement of second ball; or more away.

    3. Options: Aiming second ball at a point other than the origin. Computing and normalizing the velocity vector.

      Making the second ball stationary, at an arbitrary position.

  2. idle():
    1. Updating ball position --- this is animation.

    2. Collision detection and response, checks.

    3. Beginning the next simulation when either ball leaves the ``arena.'' No square roots.

    4. Post a re-display event to render the new scene.

  3. collision()
    1. Simply, if the distance between the centers points is less than or equal to the sum of the radii, we've had a collision.

    2. No square roots.

    3. Discrete time step simulation: penetration problems.

  4. collisionResponse()
    1. Dealing with penetration:
      1. Binary search over time step interval to find exact point of impact and take it from there. Computationally expensive.

      2. Ignore. Approximate collision point and normal. Allow collision response to push objects apart. May not look realistic, if collision response doesn't separate objects quickly enough.

      3. Approximate collision normal and move each object 1/2 of penetration distance apart along normal. This may look abrupt. Could cause a cascade of penetrations. Assumes equal forces involved.

        This is what we use.

    2. We apply equal and opposite impulses along the collision normal to the two objects to bring them apart.

    3. Collision normal (B - A), relative velocity vector (), and the projection back onto the normal ():

    4. Coefficient of restitution: , or

    5. Conservation of momentum: or:

      Similarly for .

    6. Substituting and solving for j:



Thomas P. Kelliher
Fri Feb 25 11:20:38 EST 2005
Tom Kelliher