Game Development Reference
In-Depth Information
knee from bending backwards. Conical joints or perhaps universal joints
might be used for the hips and shoulders.
Whereas a joint constraint is concerned with the position and orienta-
tion of the bodies, a motor is a type of constraint that attempts to enforce
a requested relative velocity between two bodies. For example, by using
the proper kind of motor, an application can instruct the physics engine:
“Body A should maintain an angular speed ω, relative to the axis n , which
is fixed in the reference frame of body B.”
Most physics engines have a variety of constraints, and even mechanisms
for adding your own types of constraints. Furthermore, constraints need not
be absolute, but the physics engine can be given instructions to limit the
force that may be applied to enforce the constraint. Most physics engines
provide a mechanism by which a constraint may be queried for the amount
of force that was applied in the attempt to satisfy the constraint. This query
can be quite useful, for example, to play a sound if a motor is straining,
or perhaps destroy a joint if some threshold is exceeded. Joints and their
limits can also be “soft.” For example, in the Open Dynamics Engine,
values known as the error reduction parameter (ERP) and constraint force
mixing (CFM) parameter can be tuned to cause the joint to behave like a
spring-damper system.
Although application constraints don't necessarily have any “memory”
and can be created and destroyed at will by the application—for example
to detach a wheel from a car or an arm from a body—they typically persist
across time steps. Contact constraints, in contrast, are instantiated by the
physics engine and are always destroyed within the same physics time step.
(Conceptually, at least. They may survive internally for performance or
stability reasons.) They are used to enforce nonpenetration between the
collision geometry of two bodies (or of a body and some static geometry).
These constraints are the primary output of the collision detection system
and the mechanism by which collision response is performed.
Although contact constraints are created by the physics engine during
collision detection, that doesn't mean the application cannot be involved
in the process. Physics engines provide numerous hooks to customize the
creation of these contact points and notify the application when contact
constraints are applied to a dynamics body. These hooks are a powerful
means for fine-grained customization of how particular pairs of objects in-
teract, and collision notifications are essential for implementing feedback
such as sound and particle effects or a reduction in hit points.
This section presented the three main “tables” of data in a physics
engine. The next section covers the “flowcharts”—and we hope that you
and Fred Brooks don't think they are too “obvious.”
Search WWH ::




Custom Search