Game Development Reference
Excerpt from include/cyclone/core.h
* Holds an inertia tensor, consisting of a 3x3 row-major matrix.
* This matrix is not padding to produce an aligned structure, since
* it is most commonly used with a mass (single real) and two
* damping coefficients to make the 12-element characteristics array
* of a rigid body.
// ... Other Matrix3 code as before ...
* Sets the matrix to be a skew-symmetric matrix based on
* the given vector. The skew-symmetric matrix is the equivalent
* of the vector product. So if a,b are vectors, a x b = A_s b
* where A_s is the skew-symmetric form of a.
void setSkewSymmetric(const Vector3 vector)
data = data = data = 0;
data = -vector.z;
data = vector.y;
data = vector.z;
data = -vector.x;
data = -vector.y;
data = vector.x;
Now we can work the whole basis matrix through the same series of steps:
// Create the skew-symmetric form of the cross product.
// This was a cross product.
Matrix3 torquePerUnitImpulse = impulseToTorque * contactToWorld;
// This was a vector transformed by the tensor matrix - now it's
// just plain matrix multiplication.
Matrix3 rotationPerUnitImpulse =
inverseInertiaTensor * torquePerUnitImpulse;
// This was the reverse cross product, so we'll need to multiply the