Game Development Reference
In-Depth Information
F IGURE 15.2
The long-distance dependence of reaction forces.
Each of these situations leads to problems in solving the mathematics to get a set
of reaction forces. Special-case code or tailored solving algorithms are needed to de-
tect impossibilities and react differently to them (typically by introducing an impulse
of some kind).
If this sounds complex, it's because it is. Fortunately there is a much simpler
(though slightly less accurate) solution. Rather than resolving all contacts using forces
(i.e., converting collision impulses into forces), we can do the opposite and treat rest-
ing contacts as if they were collisions.
Micro-collisions replace reaction forces by a series of impulses: one per update. In the
same way that an impulse can be thought of as a force applied in a single moment of
time, a force can be thought of as a whole series of impulses. Applying a force of 10 f N
to an object over 10 updates is equivalent to applying impulses of f Ns at each update.
Rather than calculate a set of reaction forces at each time step, we allow our im-
pulse resolution system to apply impulses. Figure 15.3 shows this in practice. The
block should be resting on the ground. At each frame (ignoring interpenetration for
Search Nedrilad ::

Custom Search