Game Development Reference
In-Depth Information
18.2
R EDUCED C OORDINATE A PPROACHES
Another technique often mentioned in game development circles (although very
rarely implemented) is the reduced coordinate approach.
In our physics engine we've given each rigid body twelve degrees of freedom: three
each for position, orientation, velocity, and rotation. The orientation uses four values
but has only three degrees of freedom: the fourth value can always be determined
from the other three (because the size of the quaternion must be 1).
When objects are in contact, or have joints between them, they are constrained.
They can no longer have any value for each of the twelve degrees of freedom. For
example, if an unliftable block is placed on the flat ground, it can only be pushed in
two directions and can only be oriented along one axis. It has only six actual degrees of
freedom (two for position, one for orientation, two for velocity, and one for rotation).
The physics system we've built in this topic allows all objects to move with twelve
degrees of freedom; then it uses impulses and non-penetration code to make sure they
behave properly. An alternative is to work out exactly how many degrees of freedom
the object has and allow only those to change.
For the block on the ground this is simple, and an example is fully worked through
in Eberly [2004], the other physics book in this series.
It involves working out the equations of motion, using Newton's laws of motion,
in terms of the degrees of freedom that are left. For anything beyond a block on a
plane this can become quite involved. When the constraints represent joints, then
degrees of freedom can be a combination of rotation and position. Finding the equa-
tions of motion can be very difficult indeed. Once the equations of motion are calcu-
lated, they can often be solved very rapidly. It is therefore a useful approach when the
degrees of freedom don't change, and the equations can be hard-coded beforehand
and solved quickly (as is the case for the example in Eberly [2004]).
For some assemblies of bodies connected by joints (such as a ragdoll where there
is a branching tree of bones and joints with no loops) there are well-known methods
for calculating the degrees of freedom and the corresponding equations of motion.
There have been a couple of single-purpose ragdoll simulators that I've seen using this
approach, but they have been in technical demos rather than in production games.
For general sets of joints the procedure is tougher, and to all intents and purposes
impractical, especially since in a game the constraints may appear and disappear at
different times (particularly the case with contact constraints).
This technique is also more difficult when it comes to introducing general force
generators. Having the ragdoll float on water or be buffeted by wind, for example,
introduces major complications into calculating the equations of motion for each
degree of freedom.
For this reason I'm not aware of any general-purpose game physics engines that
are based on reduced coordinate approaches. You may like to look at reduced coordi-
nate approaches to get specific effects, but they are unlikely to be a general solution.
Search Nedrilad ::

Custom Search