Game Development Reference
In-Depth Information
orientation.addScaledVector(rotation, duration);
// Impose drag.
velocity *= real_pow(linearDamping, duration);
rotation *= real_pow(angularDamping, duration);
// Normalize the orientation, and update the matrices with the new
// position and orientation.
calculateDerivedData();
// Clear accumulators.
clearAccumulators();
}
10.5
S UMMARY
The physics of angular motion is very similar to the physics of linear motion we met
in chapter 3. In the same way that force is related to acceleration via mass, we've seen
that torque is related to angular acceleration via moment of inertia. The physics is
similar, but in each case the mathematics is more complex and the implementation
longer. The vector position found its angular correspondence in the quaternion for
orientation, and the scalar-valued mass became an inertia tensor.
The last two chapters have therefore been considerably more difficult than those at
the start of the topic. If you have followed through to get a rigid-body physics engine,
then you can be proud of yourself. There are significant limits to what we've built so
far (notably we haven't brought collisions into the new engine) that we'll spend the
rest of the topic resolving, but there are also a lot of great things that you can do with
what we have. Chapter 11 introduces some applications for our current engine.
Search Nedrilad ::




Custom Search