Game Development Reference
In-Depth Information
including using joint motors, to physically drive the object. However, sometimes
we simply want to move an object along an animated path, totally unaffected by
collisions. Animating an object by simply setting its position is never a good
idea. It might still affect objects in its environment, but collisions will be soft and
squishy. This is partly because the velocity of the object is not updated correctly,
so for all the solver knows, there is a collision with penetration, but it is not aware
that any of the objects are moving. To avoid this, make sure to update the velocity
to match the actual motion. Some engines have convenience functions for this.
Even when the velocity is correct, if the animated object is not considerably
heavier than the objects it is colliding with, the collisions will be soft and squishy.
For an animated object to fully affect the environment, its mass and inertia tensor
should be infinite. Only then will other objects fully obey and move out of the
way. Hence, if we animate objects by setting their position, make sure to give
them correct velocity, both linear and angular, and make the mass and inertiaten-
sor temporarily infinite.
2.9 Artifact Reference
Following is a list of artifacts and their causes.
Frame rate gradually slows down to grinding halt. You might have hit
the well of despair, where the physics engine tries to compensate for its
own slow down. Put a cap on the number of physics steps per frame or
implement a more sophisticated time-stepping algorithm.
Simulation runs in slow motion. Check that the physics step size corre-
sponds to actual time. Keep an eye on simulation scale. A larger scale will
result in slow-motion effects.
Stacked objects are shaking or rattling. Check the contact-generation code
and make sure the configuration is not rapidly changing.
An aligned object dropped on a flat surface bounces off in a weird way.
This is natural behavior of Gauss-Seidel iteration.
Objects at the bottom of a stack do not feel the weight of the ones on top.
This is caused by a shock-propagation scheme or decoupled friction with
fixed maximum force.
Highly asymmetric objects act unstable. The low inertia around one of the
axes causes a lot of rotation. Increase inertia tensors, as if the objects were
more symmetric.