Our Properties: Gamasutra GameCareerGuide IndieGames Indie Royale GDC IGF Game Developer Magazine GAO
My Message close
Contents
Physics on the Back of a Cocktail Napkin
 
 
Printer-Friendly VersionPrinter-Friendly Version
 
Latest News
spacer View All spacer
 
February 8, 2012
 
PSN dev Drinkbox Studios on porting code to 'mini-PS3' quality Vita hardware
 
Critical Reception: Big Huge Games' Kingdoms of Amalur: Reckoning [4]
 
Report: French game development tax breaks may be prohibited [1]
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
February 8, 2012
 
High 5 Games
Director of Software Engineering
 
High 5 Games
Lead Game Programmer
 
Treyarch / Activision
Lighting Artist
 
Sledgehammer Games / Activision
MP Level Designer
 
Lantern
Environment Artist
 
THQ Montreal
Sr. Gameplay Programmer
spacer
Latest Features
spacer View All spacer
 
February 8, 2012
 
arrow Postmortem: CyberConnect 2's Solatorobo: Red the Hunter
 
arrow Jerked Around by the Magic Circle - Clearing the Air Ten Years Later [22]
 
arrow Building the World of Reckoning [4]
 
arrow SPONSORED FEATURE: TwitchTV - How to Build Community Around Your Game in 2012 [13]
 
arrow Happy Action, Happy Developer: Tim Schafer on Reimagining Double Fine [9]
 
arrow Building an iOS Hit: Phase 1 [11]
 
arrow Postmortem: Appy Entertainment's SpellCraft School of Magic [5]
 
arrow Talking Copycats with Zynga's Design Chief [82]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
February 8, 2012
 
Merging Waterfall and SCRUM [2]
 
Business Post Mortem: Wolf Toss: Pre-launch Planning & Blended CAC
 
Minmaxing - Is turn-based fun anymore? [53]
 
PRICED TO DIE [4]
 
What happened with Shadow Physics: An Introduction [3]
spacer
About
spacer Editor-In-Chief/News Director:
Kris Graft
Features Director:
Christian Nutt
Senior Contributing Editor:
Brandon Sheffield
News Editors:
Frank Cifaldi, Tom Curtis, Mike Rose, Eric Caoili, Kris Graft
Editors-At-Large:
Leigh Alexander, Chris Morris
Advertising:
Jennifer Sulik
Recruitment:
Gina Gross
 
Feature Submissions
 
Comment Guidelines
Sponsor
Features
  Physics on the Back of a Cocktail Napkin
by Jeff Lander [Programming]
Post A Comment Share on Twitter Share on Facebook RSS
 
 
May 16, 2000 Article Start Page 1 of 2 Next
 

 

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).


(Eq. 1)

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:


(Eq. 2)

For this example, I'm using a coefficient of restitution e of 0.8. I can use this formula to create a second equation.


(Eq. 3)

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.


(Eq. 4)

These formulas can be combined with Equation 2 to determine the impulse force given the relative velocity and the coefficient of restitution.


(Eq. 5)

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.

 
Article Start Page 1 of 2 Next
 
Comments


none
 
Comment:
 




UBM Techweb
Game Network
Game Developers Conference | GDC Europe | GDC Online | GDC China | Gamasutra | Game Developer Magazine | Game Advertising Online
Game Career Guide | Independent Games Festival | Indie Royale | IndieGames

Other UBM TechWeb Networks
Business Technology | Business Technology Events | Telecommunications & Communications Providers

Privacy Policy | Terms of Service | Contact Us | Copyright © UBM TechWeb, All Rights Reserved.