Col 0899
Col 0899
I
have decided that friction is a drag. It’s almost as easy to understand as gravity.
We deal with it every day. Friction keeps me from sliding completely under my
desk when I slouch in my chair. It keeps my car from spinning out of control as
I turn corners with reckless abandon.
This experience with friction begins in real-time 3D applications, otherwise more interesting is the fact that on a
when as babies we attempt to scoot known as the field of tribology. smaller scale, when objects rest against 19
across the carpet with the relative ease each other, atomic bonds tend to form
of the linoleum kitchen floor. We build between the objects. These bonds form
upon our experience until as elemen- Why Is It Such A Drag? a kind of glue that makes it necessary
tary age children we are able to pick up to apply extra force simply to get an
our video console controller and
expertly proclaim, “This game looks so
fake — the cars are sliding all over the
L et’s take a look at what makes up
the experience we term friction.
Grab your trusty copy of Computer
object moving.
It’s possible to measure the effect of
this roughness. In fact, this is exactly
place. The physics in this game bites!” Graphics: Principles and Practice and set what Charles Coulomb did in the late
That is the challenge game develop- it on the table. Give the book a push eighteenth century. He established a
ers face. The physical world is so famil- with a small horizontal force. Notice theory of dry friction (since called
iar to everyone in your potential audi- that if the force is small, the book will Coulomb friction) that predicts the
ence, any departure from realism can not move. As you increase the force, maximum friction forces that can be
be glaring. However, realistically simu- you will reach a point where the book exerted by dry, contacting surfaces
lating these simple physical properties will start moving. Once it’s moving, which are static, or not moving. The
is quite challenging. This month, I’m you may notice that it takes a little less theory also predicts the friction forces
going to discuss simulation of friction force to keep it moving. that the surfaces exert when they are in
How is it possible for a smooth book motion relative to each other.
on a smooth table to create a force that
F Force applied to system
resists your efforts to push it? Well, it
f Force of friction turns out that even relatively smooth Don’t Give Me No Static
N Force normal to surface surfaces are actually pretty rough if you
W Force of weight of object
due to gravity
look closely enough. It’s this roughness
that opposes your efforts. But even W hen you are applying force on
the book, the friction force
opposes your efforts. Let’s take a look
µs Coefficient of static friction
µk Coefficient of kinetic friction at a diagram of this situation. Figure 1
W shows a free body diagram of the book
w Width measurement
in static equilibrium, meaning that the
h Height measurement
F book is not moving.
A A point of reference Since the book is in static equilibri-
v Velocity of particle (vector) f um, we can determine a number of
ε Threshold of transition from things via the principles of statics. The
static to kinetic friction N normal force, N, to the collision of the
book with the surface is equal in mag-
T A B L E 1 . A summary of notations F I G U R E 1 . A book in a state of nitude to the weight of the book, W.
used in this article. static equilibrium. Also, the friction force, f, must also be
equal in magnitude to the force being
applied on the book, F.
When not fighting the friction that keeps his butt planted in Redondo Beach, Jeff cre- N=W
ates custom 3D real-time graphics applications at Darwin 3D. What’s the roughest f =F
surface you know? E-mail it to him at [email protected].
f ≤ µs N Coulomb Static Friction
f =F
Objects are in static equilibrium
A n obvious application of the
Coulomb dry friction model is
for travel over surfaces. You may have
something needs to be done. So, I sim-
ply reduce the velocity of the object as
it slides around. This can be made to
a game that requires a character to look pretty good. However, there is still
F = µs N travel over various types of terrain. By a problem.
The maximum F before a slip occurs specifying different coefficients of If you have ever pushed a box really
Therefore, the maximum force that friction for different types of terrain hard, particularly if your point of con-
can be applied on the book before it (asphalt, grass, ice, and so on), you tact is near the top of the box, the box
begins to slip is µsN. What is interest- can simulate movement over this ter- will sometimes tip over before it starts
ing, and complicated, about static fric- rain in a realistic, and even more sliding. In fact, if you throw a box
tion is the fact that the friction force importantly, a physically consistent across the room, once it hits the floor
increases to equal the applied force manner. it will tumble all over the place
until this threshold has been reached. Many games simulate friction sim- instead of simply sliding to a halt.
ply by reducing the velocity by a per- People are used to these facts. They
centage based on the surface type. live with them every day. If your
What Happens Then? This may seem at first to be the same world does not address these behav-
thing as the dry friction model iors, it will not feel right.
∑F X
= F−f =0 F =f
∑F Y
=W −N = 0 W =N
librium, the sum of all forces and the sum of all moments in ∑M A
= hF − (0.5d )W = 0
the body must equal zero. At the point of equilibrium where the box is about to slip,
When the box is about to tip over, there is only a reac-
tion to the ground at point A. The support on the other f = µ s N = µ sW
side has no reaction to the ground. Therefore, we can state So, I can substitute leaving
the equilibrium equations. Let me start with the sum of
forces.
∑M A
= h( µ s W) − (0.5d )W = 0 h = (0.5d ) / µ s
If Sara applies the force (0.5d)/µs units high or higher,
the box is going to tip over before it starts sliding. What’s
even more interesting is the fact that the equation above
states that the value for h is not dependent on anything
other than the dimensions of the box and the coefficient
of static friction. The magnitude of the force F does not
matter at all. It may seem that if Sara pushes harder, the
box would be more likely to tip. Statics proves that this is
not the case.
the acceleration
L I S T I N G 1 . Code for calculating and adding in friction.
and has a maxi-
A Word about Integration
mum of µsN. All of
// Calculate Magnitude of Fn
FdotN = DotProduct(&curParticle->contactN,&curParticle->f); these conditions
lead to a situation
I n order for this static friction
approximation to work, the particle
must build up some velocity in order
// Calculate Vt Velocity Tangent to Contact Normal that is too complex for the static force to kick in. If the
VdotN = DotProduct(&curParticle->contactN,&curParticle->v); to be calculated in value of ε is too large, it can cause the
ScaleVector(&curParticle->contactN, VdotN, &Vn); my simulation. object to crawl around a little. By
VectorDifference(&curParticle->v, &Vn, &Vt); David Baraff (see reducing this value, the crawling effect
For Further Info) can be eliminated.
NormalizeVector(&Vt); // Get the Direction of Vt suggests a couple of One unfortunate side effect of this
// Multiply By Normal force magnitude and Coef of Kinetic Friction approximations. approximation of static friction is that
ScaleVector(&Vt, (FdotN * m_Ckf), &Vt); The more com- it can play hell with your integrator.
plicated method When the particle is moving and sub-
// Add into the Force Accumulator Baraff suggests is to ject to kinetic friction, things work
VectorSum(&curParticle->f,&Vt,&curParticle->f); approach static well. However, when static friction
friction as a qua- kicks in, the direction of the static fric-
dratic program- tion force swings wildly with small
Static Friction ming problem. However, this method fluctuations in velocity. This plays
24 is prone to failure in certain circum- havoc with the integration. If the value
for ε is too small, the differential equa-
H andling static friction, however,
is much more complicated. The
problem is that static friction requires
stances. The other suggestion, fortu-
nately, is easy to implement.
First, establish a velocity threshold
tions can become “stiff,” requiring
more complex integration techniques
that I determine when each contacting value ε which determines when to use (See “Lone Game Developer Battles
particle makes the transition to sliding. static friction. This threshold is then Physics Simulator,” Graphic Content,
From the calculations above, I know used to scale the friction force as the April 1999).
that the point of transition is when velocity varies from 0 to this thresh-
F = µsN. Until that transition occurs, old. The formula for calculating the
the static friction force needs to pre- static friction force then becomes Let’s Drag
vent sliding completely. That is, I need F = (µsN)(v/ε). This force is applied in
to make sure that the particle accelera-
tion is kept at zero. Once the particle
begins sliding, then the force opposes
the direction opposite the velocity of
the particle. Listing 2 contains the code
for handling the static friction forces.
N ow I can get objects to tumble
around realistically as well as slow
to a halt based on the current coeffi-
cients of friction. You can download the
source code and executable to the sam-
L I S T I N G 2 . Code for handling static friction forces. ple application from the Game Developer
web site (http://www.gdmag.com). ■
// Calculating Magnitude of Fn
FdotN = DotProduct(&curParticle->contactN,&curParticle->f); FOR FURTHER INFO
• Baraff, David. “Coping with Friction for
// Calculating Vt Velocity Tangent to Contact Normal
Non-Penetrating Rigid Body
VdotN = DotProduct(&curParticle->contactN,&curParticle->v);
Simulation,” Siggraph Proceedings:
ScaleVector(&curParticle->contactN, VdotN, &Vn);
July 1991, pp. 31–40.
VectorDifference(&curParticle->v, &Vn, &Vt);
Vmag = VectorSquaredLength(&Vt);
NormalizeVector(&Vt); // Get the Direction of Vt • Beer and Johnston. Vector Mechanics
if (Vmag > STATIC_THRESHOLD) // Handle Static Friction for Engineers: Statics, Sixth Ed. New
{ York: WCB/McGraw-Hill, 1997.
ScaleVector(&Vt, (FdotN * m_Ckf), &Vt);
// Multiply By Normal force magnitude and Coef of Kinetic Friction • Hecker, Chris. “Behind the Screen”
VectorSum(&curParticle->f,&Vt,&curParticle->f); columns. Game Developer, October
} 1996–June 1997. Also available on
else // Handle it as Kinetic Friction Chris’s web site at http://www.d6.com.
{
Vmag = Vmag / STATIC_THRESHOLD; • Lötstedt, P. “Numerical Simulation of
// Multiply By Normal force magnitude and Coef of Static Friction Time-Dependent Contact Friction
// And Static approximation ratio Problems in Rigid Body Mechanics.”
ScaleVector(&Vt, (FdotN * m_Csf * Vmag), &Vt); SIAM Journal of Scientific Statistical
VectorSum(&curParticle->f,&Vt,&curParticle->f); Computing Vol. 5, No. 2 (June 1984): pp.
} 370–393.