Game Development Reference
In-Depth Information
7
H ARD C ONSTRAINTS
having multiple objects affect one another. This is the first time we've had objects
that move based on the motion of other objects.
While springs can be used to represent many situations, they can behave badly.
When we want objects to be tightly coupled together, the spring constant we need
is practically impossible to simulate. For situations where objects are linked by stiff
rods, or kept apart by hard surfaces, springs are not a viable option.
In this chapter I'll talk about hard constraints. Initially we'll look at the most com-
mon hard constraint—collisions and contact between objects. The same mathematics
can be used for other kinds of hard constraints, such as rods or unstretchable cables,
that can be used to connect objects together.
To cope with hard constraints in our physics engine we'll need to leave the com-
fortable world of force generators. All the engines we're building in this topic treat
hard constraints different from force generators. At the end of the topic, in chap-
ter 18, we'll look briefly at alternative approaches that unify them all into one again.
In the last chapter we looked at springs both as a force generator and as one way of
7.1
S IMPLE C OLLISION R ESOLUTION
To cope with hard constraints we'll add a collision resolution system to our engine.
For the sake of this part of the topic, a “collision” refers to any situation in which
two objects are touching. In normal English we think about collisions being violent
processes where two objects meet with some significant closing velocity. For our pur-
poses this is also true, but two objects that just happen to be touching can be thought
of as being in a collision with no closing velocity. The same process we use to resolve
103
Search Nedrilad ::




Custom Search