Sorry for again having to post such a little bug, but the effects can be dramatic.
Please replace
Code:
void SetAngularVelocity(const MATHVECTOR <T, 3> & newangvel)
{
angular_momentum = inverse_inertia_tensor.Inverse().Multiply(newangvel);
RecalculateSecondary();
}
with
Code:
void SetAngularVelocity(const MATHVECTOR <T, 3> & newangvel)
{
angular_momentum = world_inverse_inertia_tensor.Inverse().Multiply(newangvel);
angular_velocity = newangvel;
}
To not RecalculateSecondary is just a minor optimation, but what really matters is the world in
world_inverse_inertia_tensor
This can lead to a very strange problems, should the function be used somewhere.