I am generally pretty disciplined about working normal hours during the week. However, on Fridays I like to shoot pool and eat pizza at the local sports bar. Since happy hour starts at three, I sometimes need to move work down the street. I was working out how to win a serious game of nine ball when one of those geeky discussions broke out about pool table physics. Pool, like many sports, is dominated by the laws of physics. Good players have an excellent sense of the application of force, the physics of collisions, and the influence of friction on objects in motion.
Last month I described how friction could be used to increase the realism of the physics model in real-time games. The demo program made it possible to see how various coefficients affected a mass-and-spring model. However, it wasn't very much fun. In order to demonstrate how a solid physical foundation can actually create interesting game play, I need to pull some of these concepts together into a real application. A pool table simulation is a natural choice. It will allow me to apply many of the techniques I have covered as well as provide some ideas that can be converted easily to other sports such as golf or tennis.
Like most things in life, pool provides an
excellent venue for a physics lesson.
Two Ball, Corner Pocket
Table 1. A summary of the
notation used in this article.
In order to understand pool, I need to understand collisions between billiard balls. Fortunately, billiard balls are all spheres of equal size and weight. That makes the collision calculations a bit easier. Let me begin by looking at the frictionless case. I suspect that if I ignore the ball's rotation and do not consider friction, the ball collision will behave exactly like a particle at the ball's center of mass. That would be great, as I could use the code from a previous column. However, I want to make sure. Figure 1 shows a typical collision.
Ball A is moving at a speed of 20 feet per second and collides with ball B at a 40 degree angle. In order to determine the velocity of each ball after the collision, I need to apply dynamics. A collision between two rigid bodies, which occurs in a very short time and during which the two bodies exert relatively large forces on each other, is called an impact. The force between these two bodies during the collision is called an impulsive force, which is symbolized by j. The common normal to the surfaces of the bodies in contact is called the line of collision, represented as n in Figure 1.
Figure 1. A simple collision between two billiard balls.
The first step is to break the initial velocity of ball A into its components along the line of collision, n, and the tangent to the collision, t.
The impulsive force acting during the collision is directed along the line of collision. Therefore, the t component of the velocity of each ball is not changed.
In order to determine the new velocity along the line of collision, I need to look at the impulsive force between the bodies. The impulse acts on both bodies at the same time. You may remember Newton's third law of motion, the forces exerted by two particles on each other are equal in magnitude and opposite in direction.
Since the impulse forces are equal and opposite, momentum is therefore conserved before and after the collision. Remember that the momentum of a rigid body is mass times velocity (mv).
This equation can't be solved without some more information. In my previous article "Collision Response: Bouncy, Trouncy, Fun", I discussed the coefficient of restitution. This is the scalar value between 0 and 1 relating the velocities of bodies before and after a collision via the formula:
For this example, I'm using a coefficient of restitution e of 0.8. I can use this formula to create a second equation.
Solving Equations 1 and 3, I get the velocities of the two billiard balls after the collision.
In order to solve this problem in the simulation, I need to derive the impulse force directly. The impulse force creates a change in momentum of the two bodies with the following relationship.
These formulas can be combined with Equation 2 to determine the impulse force given the relative velocity and the coefficient of restitution.
You can plug Equation 5 back into the example problem and make sure it works. Remember that because of Newton's third law, the impulse is equal and opposite for the two colliding bodies. When you apply Equation 5 to the B ball, remember to negate it.
Those of you who read Chris Hecker's column on collision response ("Physics, Part 3: Collision Response," Behind the Screen, Game Developer, February/March 1997) will recognize Equation 4 as the impulse equation for a general body that does not rotate. When we do not consider the rotation of the billiard balls, they behave exactly like the particles used in my March 1999 mass-and-spring demo. My suspicion was correct, and I can use the particle dynamics system as a base for the demo.
For many applications, this would probably be more than enough to get a decent physical simulation. In fact, I imagine many pool simulations end right there. This level of simulation is probably sufficient for other games, such as pinball. However, anyone who has played much pool knows that this is not the end of the story. The rotation of the ball caused by the reaction with the table makes a tremendous difference in the realism of the simulation.