Game Development Reference
In-Depth Information
where dampe k is a positive constant that determines how strong the damper is. As
with the spring force, the force damper
is experienced by the particle at P , and the
F
force
F is experienced by the particle at Q .
In order to finely tune the behavior of our cloth, we can choose different
spring and damper constants for the different types of connections in the cloth.
For example, we might use a large spring constant for the long springs connect-
ing particles two grid points apart to make the cloth highly resistant to bending.
It's important not to go too high, however, because strong springs have a tenden-
cy to introduce unwanted vibration into the simulation.
damper
15.2.2 External Forces
If all of the particles in our cloth are initially placed so that all of the springs have
their rest lengths, then nothing would ever move in our cloth simulation. In order
to see some animation, we need to apply some external forces, the most obvious
of which is gravity. Each particle in the cloth experiences a force
g ,
(15.40)
F
gravity m
=
where m is the mass of the particle, and g is the acceleration of gravity (which
would normally be
2
g ).
After gravity, the most common force applied to a cloth is due to wind, or
more precisely, the difference between the velocity of the cloth and the velocity
of the air. For a particle at the point P where the unit normal direction to the cloth
is N , the force due to the wind is given by
=
0, 0,
9.8 m s
(
)
d
P
WN .
(15.41)
F
=
k
wind
wind
dt
Here, W is the velocity of the wind, and win k is a constant that controls how
quickly the wind accelerates the cloth, which is an adjustable parameter that
could depend on factors such as the heaviness of the air or whether any air blows
through the cloth. The dot product with the normal causes the force to be greatest
when the wind direction is perpendicular to the tangent plane of the cloth and
least when the cloth is nearly aligned to the wind direction. We take the absolute
value because it doesn't matter which side of the cloth that the wind strikes.
15.2.3 Implementation
For each particle in our cloth, we store a three-dimensional position and a three-
dimensional velocity. We animate our cloth by updating the positions and veloci-