Impulse Physics -
Iterative Constraint Demo
by Ben Kenwright
Using the basic impulse methods, we can construct various
constraints, which go beyond the basic collision contacts. These
include ball-joints, hinges, joints, angular-linear combinations
etc. Of course once you've created one constraint you can combine
it with other constraints to form more complicated ones.
The beauty of using impulse base methods is the principles are easy to
follow and work with, also, using the method in the examples, we can
use multiple iterations to validate the constraint, so the more
iterations you apply the more accurate the constraint is to its ideal
solution. (For example, when large forces are applied, you'll
usually need to apply more iterations ~2-10).
PART 1 - The Theory
|Well to give a bit of theory on the subject, I
thought I'd include the technical paper on the subject which I wrote,
it mostly focuses on the equations used and the principles being
applied to real time characters for use in games. Its just for
those who want to diverge a bit more into the details rather than the
coding side of it.
Its in an easy to download pdf file, so for those like myself, who like
to sit down with a coffee and read over things
PART 2 - Basic Code and Test Cases
The first demo was basically to test out all sorts of test cases,
bridges, stacks of blocks, bowling, marbles, various shapes, and
variuos simple test ragdolls to see how framerate, collisions, stablity
PART 3 - Focusing on Characters
Of course, using the basics from the above demo, I focused more on
characters, adding in a custom .x loader/parser, so I could load in .x
models and render there skeleton with a ragdoll, while also applying a
skin. Seemed to perform quiet well, some of the lesser bones like
fingers where thrown away, to simplify the number of ragdoll
bones. Also, a simple blending option to test the blending
between the animation-ragdoll was added with a slider.
|Ragdolls are fun, so I decided to focus on
them. Improving there constraints, and making the code more
robust so it could handle invalid joint positions without exploding.
You can choose to use, ellipsoids, spheres, boxes etc for the various
joints as in the previous example. I just chose boxes for the
screenshots as there the default for the ragdolls.
The zip file is a little big, as I included the test .x model files with
PART 4 - Further Work
This is a never ending rabbit hole, so many exciting things to still
try, but a few major ones to look at are:
o Applying a more parallel architecture to the impulse updates - maybe
multiple threads to increase the bottleneck.
o Creating more joint types.