Game Development Reference

In-Depth Information

External forces.
Soft bodies are also exposed to external forces due to collisions.

It is not in the scope of this chapter to deal with all the theory of collision response.

We will briefly mention some of the approaches to computing forces due to col-

lision. The most common approach is to apply
penalty forces
. By definition, the

computed force depends on the penetration depth information between two col-

liding objects. The resulting force tries to minimize or reduce such penetration.

Usually, a skin depth is added to the objects so there is always a virtual penetra-

tion. Thus, the force
f
is usually computed using the penetration distance
d
and

the velocity of the object's penetration
v
in a mass-spring model:
f
=
kd
+
b v
,

where
k
and
b
are respectively the stiffness and damping of the spring. This way

of computing forces is fast and straightforward, but as in all mass-spring systems,

it is difficult to choose its parameters and even more difficult to relate them to the

real elasticity of the object. Furthermore, the forces are locally applied, ignoring

the inertia of the object.

The other approach is based on a constraint scheme. The approach is com-

monly used in rigid-body dynamics, where no penetrations are formulated as a

linear complementary problem (LCP). The general idea is to identify the contact

points between two objects; for example, a box colliding with another box will

have four pairs of contact points, one for each corner. Each corner contact defines

a constraint where we want to keep a zero penetration distance. This is known

as a constrained optimization problem. Some commercial software use this ap-

proach combined with impulses to skip one level of integration, but its use with

soft bodies might become very lengthy. This is because the inherent nature of a

deformable body may lead to an excessive number of constraints.

10.4 Solving the Linear System

In the previous sections, we have seen how to build a linear system using the

finite element method (see Equation (10.17)). That system has to be solved in

every iteration. In this section, we will propose different ways to solve that linear

system. It is not our intention to describe all these methods deeply; instead, we

are going to propose some well-known techniques and give cues about when and

how to use them.

Before choosing a method to solve our linear system, we need to know its

properties. Our equation system has the following form:

S
x
=
b,

(10.22)

where
S
is the coefficient matrix,
x
is the unknown vector and
b
is the constant

terms vector. Matrix
S
is symmetric, positive definite, and sparse. We recommend